Section 9.6. Something Old, Something New


9.6. Something Old, Something New

The title of this section is from that old wedding rhyme about what a Western bride carries on her wedding day:

Something old, something new; something borrowed, something blue

Old, new, borrowed, and blue are all adjectives that can be used to describe the experience of creating applications that move between the different levels of the DOM, or from the BOM to the newer DOM.

Many of the existing JavaScript libraries or sample scripts still use technologies that worked with the old 4.x browsers popular in the late 1990s. With IE 4.x and Navigator 4.x, JavaScript and DHTML really took off, so it's not surprising that much of these older scripts are still easily available. Particularly since many of them still work.

Today, modern browsers such as IE, Firefox, Mozilla, Navigator, Opera, Safari, Camino, and others adhere to the W3C as much as possible. I emphasize the last phrase because it has a great deal of meaning in cross-browser and cross-version web-page development. The possibilities are limited by how widespread the use of some technologies are. For instance, Microsoft's newer IE 7 supports the newer DOM, up to the point where support would mean breaking older web pages. The company isn't necessarily ready to break backward compatibility, and though not doing so is a pain for web developers, it's also somewhat understandable.

So modern browsers borrow some of the older implementations, as well as support the newer. Developers use a variety of tests to see if one element or another is supported to provide functionality that works with as many browsers as possible. This tends to make the developers feel a little "blue"if that's the right wordbecause the work can be rather extensive and difficult at times.

This demonstrates one of the major challenges with cross-browser JavaScript: having to, at times, compromise on what objects, properties, and methods you'll use to create content that works for all of your target browsers. For all of the criticism associated with Internet Explorer, Microsoft was the leader of the pack when it came to providing more features for dynamically changing a web page. As such, its unique properties and methods, though they may not be a part of any W3C specification, have had widespread use and continue to be used today.

The question then becomes: should you use them? I can't answer this for you. The more you use older objects, the quicker your pages will become obsolete. In addition, the more older browsers you support, the more work and the more limited the effects you can create. All I can do is point out some of the options, the older technologies as well as the newer, and how they can be compatibleor not.

The only people who can answer this question are your web-page readers. Know your audience and what tools they use, and adjust accordingly. No worries, though, that you'll be thrust out into the wild kingdom of the Web with only a stone axe and bearskin bikini. In the next several chapters, I'll show you how to use the old BOM with the new DOM and when to borrow between the models.




Learning JavaScript
Learning JavaScript, 2nd Edition
ISBN: 0596521871
EAN: 2147483647
Year: 2006
Pages: 151

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net