Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15668

Re: Using getElementsByClassName with IE9

From "Jukka K. Korpela" <jkorpela@cs.tut.fi>
Newsgroups comp.lang.javascript
Subject Re: Using getElementsByClassName with IE9
Date 2012-09-03 23:43 +0300
Organization A noiseless patient Spider
Message-ID <k234om$kq4$1@dont-email.me> (permalink)
References <5n3a485gralsf2i33di638i61cmb9iirvn@4ax.com>

Show all headers | View raw


2012-09-03 23:22, Carl Mirren wrote:

> supposedly I can use getElementsByClassName on both the global
> document variable and any HTML element with IE9 or higher.

Yes, but only in "Standards Mode".

> If I run
> code using it - with a table (DispHTMLTable) - I get
>
> SCRIPT438 Object doesn't support property or method
> 'getElementsByClassName'
>
> in the IE9 developer tools (F12), browser mode IE9, document mode
> Quirks.

The same happens if you test with simply document.getElementsByClassName().

> According to JavaScript: The Definitive Guide 6th edition p. 369 this
> function is supposed to be missing only in IE8 or earlier.

Yes, and right before that the book discusses Quirks Mode. But still IE 
9 does not recognize the method in Quirks Mode. Perhaps some older 
subversions of IE 9 did. Or maybe this was a testing error. It's easy to 
get confused here. Suppose you test with a document starting with 
<!doctype html>, find out that the method works, remove the doctype line 
and retry, finding that the method still works, so it's OK in Quirks... 
- wait, it isn't. IE can be sticky with the mode. It seemed to work, 
because the browser remained in "Standards Mode". Manually changing the 
mode to Quirks Mode reveals the truth.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Using getElementsByClassName with IE9 Carl Mirren <invalid@invalid.invalid> - 2012-09-03 22:22 +0200
  Re: Using getElementsByClassName with IE9 "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-09-03 23:43 +0300

csiph-web