Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #25917
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: eventDispath how that work |
| Date | 2014-10-16 02:48 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <1784537.FLLm03yfTo@PointedEars.de> (permalink) |
| References | (1 earlier) <16yzpmtikrwk0$.1schjt968gcx$.dlg@40tude.net> <1791221.7QuZn8ShVB@PointedEars.de> <14ignx5l3afjk.j09ycbpj6e7h.dlg@40tude.net> <1695306.Qhb0f9IOXP@PointedEars.de> <m1mqn3$jtd$1@speranza.aioe.org> |
Joao Rodrigues wrote:
> On 15/10/2014 18:02, Thomas 'PointedEars' Lahn wrote:
>> Correction: The latter would be equivalent to
>>
>> document.querySelectorAll(".foo")
>>
>> Instead,
>>
>> document.getElementsByClassName("foo")[0]
>>
>> would be equivalent to the former, provided that the method returned
>> a reference to an object implementing the NodeList or HTMLCollection
>> interface (which would need to be tested before the “0” property read
>> access).
>
> Pardon me, but these methods are not equivalent because:
>
> a) The getElementsByClassName() method returns a live NodeList whereas
> querySelectorAll() returns a static NodeList;
ACK.
> b) The getElementsByClassName() method excludes any elements that are
> not descendants of the HTMLElement object on which the method was
> invoked.
Your logic is flawed. getElementsByClassName() was not invoked on an object
implementing the HTMLElement interface here; it was invoked on an object
implementing the (HTML)Document interface. That is a separate method, as
even your own references say.
> […]
> var div = document.getElementById("bar");
> var p = div.querySelector("body p");
So this example does not apply here in two respects:
1. another method
2. another selector
> <http://www.w3.org/TR/2008/WD-html5-20080610/dom.html#getelementsbyclassname>
> <http://www.w3.org/TR/selectors-api2/>
Again you have referred to a Working Draft and a Working Group Note, which
both are non-normative, although a Proposed Recommendation and a
Recommendation, respectively, are available.
<http://www.w3.org/TR/2014/PR-html5-20140916/infrastructure.html#common-dom-interfaces>
refers to
<http://www.w3.org/TR/dom/#document>
and thus
<http://www.w3.org/TR/dom/#dom-document-getelementsbyclassname>
and
<http://www.w3.org/TR/dom/#dom-parentnode-queryselectorall>
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
eventDispath how that work Une Bévue <unbewusst.sein@fai.invalid> - 2014-10-14 16:23 +0200
Re: eventDispath how that work JJ <jj4public@vfemail.net> - 2014-10-15 03:24 +0700
Re: eventDispath how that work Une Bévue <unbewusst.sein@fai.invalid> - 2014-10-15 10:49 +0200
Re: eventDispath how that work Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-15 15:24 +0200
Re: eventDispath how that work JJ <jj4public@vfemail.net> - 2014-10-16 02:10 +0700
Re: eventDispath how that work Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-15 23:02 +0200
Re: eventDispath how that work Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-10-15 18:59 -0300
Re: eventDispath how that work Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-16 02:48 +0200
Re: eventDispath how that work Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-16 18:11 +0200
Re: eventDispath how that work Une Bévue <unbewusst.sein@fai.invalid> - 2014-10-15 22:06 +0200
Re: eventDispath how that work Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-15 23:39 +0200
Re: eventDispath how that work Une Bévue <unbewusst.sein@fai.invalid> - 2014-10-16 14:26 +0200
Re: eventDispath how that work Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-10-16 14:39 -0300
Re: eventDispath how that work Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-10-16 19:44 -0300
Re: eventDispath how that work Une Bévue <unbewusst.sein@fai.invalid> - 2014-10-17 09:00 +0200
Re: eventDispath how that work Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-10-17 10:16 -0300
Re: eventDispath how that work Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-17 21:40 +0200
Re: eventDispath how that work Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-10-17 17:03 -0300
Re: eventDispath how that work Une Bévue <unbewusst.sein@fai.invalid> - 2014-10-18 15:46 +0200
Re: eventDispath how that work Une Bévue <unbewusst.sein@fai.invalid> - 2014-10-17 08:26 +0200
csiph-web