Link to home
Start Free TrialLog in
Avatar of campinam
campinam

asked on

onresize and validation

While using HTML 4.01 Transitional, I add the onresize event handler to the <body> tag. This does the job in all browsers. However, EW marks the attribute as "not permitted".
        1. Does this mean "not permitted for validation"? (Attribute is obviously permitted by browsers, as it performs OK.)
EW actually states "not permitted for the <body> tag".
        2. Is onresize permitted for other tags? (Doesn't validation require all handlers be removed from HTML?)
I wonder what is a reason for this validation requirement, as it looks a lot more difficult to read / edit / fix code when handlers do not show as element attributes in HTML, but instead are hidden in .js files. I understand separation of HTML code and script, but isn't this too much of that?
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of leakim971
Avatar of campinam
campinam

ASKER

Thank you much.
But why are handlers like onselectstart or ondragstart not allowed on <div>, for instance?
Actually, should ALL handlers be removed from HTML in order for the page to validate?
HTML5!  You are validating with HTML4.01 and ondragstart is valid in HTML5.  There is an onselect but not onselectstart which logically would not make sense anyway. You don't need a start and stop event for selection.

Browsers will sometimes support thing ahead of the standard release, and sometimes they play catch up and support something long after the release.

There is no law that says you have to validate, or that you can't use proprietary code, but a prudent professional generally follows standards so they can make a living developing new projects instead of hacking out patches to get around incompatibilities.

As for any WHY when it comes to standards; it is always the same answer.  Standards are the compromise that competing interest could agree to.
I appreciate your insight.
Hopefully, browsers won't cancel support for old pages for the next 20 years... (?)
If they do there will be a lot of broken sites; but it won't be the first time that developers have had to retrofit.