Skip to Content
Head Rush Ajax
book

Head Rush Ajax

by Brett McLaughlin
March 2006
Beginner to intermediate
448 pages
13h 33m
English
O'Reilly Media, Inc.
Content preview from Head Rush Ajax
you’re on your way
237
the document object model
Some browsers don’t recognize Node
Unfortunately, some web browsers don’t support the Node
class in your JavaScript. Your code won’t run, and you’re back
to dealing with errors and null values.
if (someNode.nodeType == Node.ELEMENT_NODE) {
// Do something with the element node
} else if (someNode.nodeType == Node.TEXT_NODE) {
// Do something with the text node
}
All browsers support the
nodeType proeprty...
...but several browsers report an
error right here.
Here’s IE reporting
that it doesn’t
recognize the Node
object in your code.
Q:
So as long as my users aren’t running Internet
Explorer, I can use the Node object, right?
A: Actually, you shouldn’t ever use the Node object... at least
not until all major browsers support the Node object. Even if you
don’t think your users are running IE, it’s still the world’s most
popular browser (by a long-shot). In the next chapter, you’’ll see
that you can get the same results with a little more work, and end
up with code that works on all browsers.
questions
Frequently asked
?
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer
How to Become a Game-Changing Leader

How to Become a Game-Changing Leader

Douglas A. Ready, Alan Mulally

Publisher Resources

ISBN: 0596102259Errata PageSupplemental Content