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


Groups > comp.lang.javascript > #15666 > unrolled thread

Using getElementsByClassName with IE9

Started byCarl Mirren <invalid@invalid.invalid>
First post2012-09-03 22:22 +0200
Last post2012-09-03 23:43 +0300
Articles 2 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  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

#15666 — Using getElementsByClassName with IE9

FromCarl Mirren <invalid@invalid.invalid>
Date2012-09-03 22:22 +0200
SubjectUsing getElementsByClassName with IE9
Message-ID<5n3a485gralsf2i33di638i61cmb9iirvn@4ax.com>
Hi all,

supposedly I can use getElementsByClassName on both the global
document variable and any HTML element with IE9 or higher. 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.

According to JavaScript: The Definitive Guide 6th edition p. 369 this
function is supposed to be missing only in IE8 or earlier. Besides,
when I hover over the element on which I call that function, the
method is offered in its "[Methods]" list. What am I missing?

Regards,
C.M.

[toc] | [next] | [standalone]


#15668

From"Jukka K. Korpela" <jkorpela@cs.tut.fi>
Date2012-09-03 23:43 +0300
Message-ID<k234om$kq4$1@dont-email.me>
In reply to#15666
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/

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web