Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: "Christoph M. Becker" Newsgroups: comp.lang.javascript Subject: Re: Retrieve a select from a table cell Date: Tue, 14 Jul 2015 23:20:32 +0200 Organization: solani.org Lines: 30 Message-ID: References: <1461265.Ovo60OvCif@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: solani.org 1436908827 32505 eJwFwQkBwDAIA0BLa4GwyOH1L6F3JjgoVxjU1va4jC/7wplc+peaPyY4RJfejvIUUKOuAQ8c6xEm (14 Jul 2015 21:20:27 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Tue, 14 Jul 2015 21:20:27 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 X-User-ID: eJwFwQkBwDAIA0BLa/nlEFL8S9idiR+fUDdXW1tm2Ou64wXlU2UQYG5HXZwc1u7XJQvOg/w3zxKW In-Reply-To: <1461265.Ovo60OvCif@PointedEars.de> Cancel-Lock: sha1:uoFPdCw7WwmFW0bkXKBKgDdNK/U= X-NNTP-Posting-Host: eJwFwYkRwDAMArCZcgSIx/FT7z9CJUJH7SvqcrlzCl/BgzDVzLpBrwW/DiDUSCNyPM+eHxdyEMo= Xref: csiph.com comp.lang.javascript:28423 Thomas 'PointedEars' Lahn schrieb: > Christoph M. Becker wrote: > >> Alternatively, you can retrieve all select elements with >> Element.getElementsByTagName("select"). > > You are writing interface names as if they would refer to objects. This is > confusing, and wrong if taken verbatim, because in recent DOM > implementations those names can and do refer to objects, but not to objects > that implement the interface, but objects that provide access to its > features via the prototype chain. Unfortunately, this mistake of > oversimplification is perpetuated by references such as MDN. Yes, you're right. I have considered to write Element.prototype.getElementsByTagName() instead, but that may not be correct either – with host objects "you never know". > [I am writing Element::getElementsByTagName(…) when I am referring to the > abstract method of the interface, and element.getElementsByTagName(…) when I > am referring to the implemented method of the element object referred to by > “element” instead.] That seems to be reasonable, and I tend to follow this convention prospectively, even though it seems to be rather uncommon for ECMAScript and as such potentially confusing for readers. -- Christoph M. Becker