Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: eventDispath how that work Date: Thu, 16 Oct 2014 02:48:56 +0200 Organization: PointedEars Software (PES) Lines: 67 Message-ID: <1784537.FLLm03yfTo@PointedEars.de> References: <16yzpmtikrwk0$.1schjt968gcx$.dlg@40tude.net> <1791221.7QuZn8ShVB@PointedEars.de> <14ignx5l3afjk.j09ycbpj6e7h.dlg@40tude.net> <1695306.Qhb0f9IOXP@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1413420539 29674 eJwFwYEBgDAIA7CXxFGG5xQo/59gghMWfT0QjsVOstsNR8gSiOkYqf2odt+k2cfym0o9JH8+TxJ8 (16 Oct 2014 00:48:59 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Thu, 16 Oct 2014 00:48:59 +0000 (UTC) User-Agent: KNode/4.14.1 X-User-ID: eJwFwYEBwCAIA7CXUNsi5yCD/09YwqOlcogCh6MoaKeEsD5hIl5faXuwtJK53NtRH6fPh7lpAcD69ttdPygeFO0= Cancel-Lock: sha1:wa0z6W/UnU3P6z4+8rIFb6B7SbY= X-NNTP-Posting-Host: eJwFwQkBwDAIA0BLQAmPnMEa/xJ6hxMamx4IB8Eu8qpVrfUIp5NneTEBrc95gymmAsz88Hwn4BFG Xref: csiph.com comp.lang.javascript:25917 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 > > 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. refers to and thus and -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not Cc: me. / Bitte keine Kopien per E-Mail.