• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Please, DOM, Don't Hurt 'Em

DOM-based scripts won't do a bit of good for browsers that entirely lack support for the W3C DOM standard. Netscape 4 is our chief problem here. The solution is to sniff for DOM compliance, and in its absence, to serve alternate content or an alternate web page.

That we sometimes need to do so is regrettable. The goal of standards is to serve the same content to all user agents. In the case of HTML and XHTML, we can do exactly that. Where CSS is concerned, in Chapter 9, “CSS Basics,” we saw how the Two-Sheet method enables us to send the same files to all user agents, while using the @import directive to protect old browsers from styles they can't handle. And in Chapters 12, “Working with Browsers Part II: Box Models, Bugs, and Workarounds,” and 13, “Working with Browsers Part III: Typography,” we learned how the Box Model Hack can exploit parsing bugs in IE5/Windows and outdated versions of Opera to serve the same styles to all without generating errors in browsers like IE5/Windows that get font sizes and the box model wrong.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint