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?
campinamAsked:
Who is Participating?
 
COBOLdinosaurCommented:
Standards are developed by a committee that includes the browser manufacturers. When a non-approach is "allowed" by a browser it is generally for backward compatibility.  If you continue to use such methods you run the risk that a browser will discontinue it and break your pages, or that newer browsers will be more strict and not support your pages.

As to "hiding" events in script.  That is not the case. The body does not have a re-size method.  On the document and window there is a re-size method.  The body can only be re-sized in response to a re-sizing of the document or window; or through scripting to modify its style properties.  The re-size in the body tag is semantically incorrect, and needed to be removed to maintain the integrity of the DOM.

 
0
 
leakim971PluritechnicianCommented:
0
 
campinamAuthor Commented:
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?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
COBOLdinosaurCommented:
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.
0
 
campinamAuthor Commented:
I appreciate your insight.
Hopefully, browsers won't cancel support for old pages for the next 20 years... (?)
0
 
COBOLdinosaurCommented:
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.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.