Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

onresize and validation

Posted on 2011-10-31
6
Medium Priority
?
473 Views
Last Modified: 2012-05-12
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?
0
Comment
Question by:campinam
  • 3
  • 2
6 Comments
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 2000 total points
ID: 37060448
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
 
LVL 83

Expert Comment

by:leakim971
ID: 37060523
0
 

Author Comment

by:campinam
ID: 37060935
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 37063667
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
 

Author Comment

by:campinam
ID: 37066039
I appreciate your insight.
Hopefully, browsers won't cancel support for old pages for the next 20 years... (?)
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 37066152
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question