- From: Peter Sloetjes <pjs.nl@live.com>
- Date: Mon, 26 Aug 2013 17:18:08 +0200
- To: Anne van Kesteren <annevk@annevk.nl>, "www-dom@w3.org" <www-dom@w3.org>
- Message-ID: <DUB119-W73ADF1150C14FFEFE102EE6490@phx.gbl>
Thanks for pointing me to 'element.matches'. However, the issue is not selecting conveniently, but looping efficiently over the result. I see no reason why getElementsByTagName or querySelectorAll should force the arbitrary choice between including or excluding the root element in the search on the caller. This choice leads to ugly and slow code in many other use cases, which however are so similar to the given example that I do not bother detailing them. I would instead like to be provided with the use case analysis that led to the current arbitrary choice. Perhaps you should consult the opinion of other developers of JS frameworks and browser extensions. Peter Sloetjes, Firefox add-on developer. P.S. I did tests with XPath, but found it to be too slow. > Date: Mon, 26 Aug 2013 10:29:05 +0100 > Subject: Re: Optionally include root element with getElementsByTagName and querySelectorAll > From: annevk@annevk.nl > To: pjs.nl@live.com > CC: www-dom@w3.org > > On Mon, Aug 26, 2013 at 1:08 AM, Peter Sloetjes <pjs.nl@live.com> wrote: > > Example of a use case: > > A generalized cloneNode function that clones a document subtree and then > > clones the content of any contained canvas elements, including that of the > > root in case it is a canvas element. > > You can just run .matches() on the element you run the queries on > (whenever we define and implement that fully). I don't think we should > add special semantics just for this scenario. > > > -- > http://annevankesteren.nl/
Received on Monday, 26 August 2013 15:20:01 UTC