- From: Reece Dunn <msclrhd@googlemail.com>
- Date: Wed, 8 Apr 2015 16:42:48 +0100
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: www-style list <www-style@w3.org>
On 8 April 2015 at 14:58, Boris Zbarsky <bzbarsky@mit.edu> wrote: > On 4/8/15 7:29 AM, Reece Dunn wrote: >> >> Assuming that you just have the DOM data structure in memory, you have >> an in-order traversal of the DOM. > > Stop right there. > > You're solving the "here is a selector, find the nodes it matches" problem. > The "fast" profile is meant to solve the "here is a node, find all the > selectors that match it" problem, since the latter problem is the one > relevant to CSS styling of a DOM. Oh, okay. That was not clear in the original email and the Selectors Level 4 specification indirectly implies this (the fast profile mentions it is applicable everywhere and the complete profile mentions it is applicable to the `query()` method): 1. Shouldn't the fast profile give an example ("For example, the element.matches() method defined in [DOM] can use the 'fast' profile.")? 2. Shouldn't the example in the complete profile be changed to "For example, the document.queryAll() method defined in [DOM] should use the complete profile."? NOTE: These changes use the DOM APIs described in the introduction, for the node-based (matches) and DOM traversal (queryAll) use cases. This helps clarify the intended usage. Q: Should the DOM functions be `querySelectorAll` instead of `queryAll` and `querySelector` instead of `query`, as I cannot find query/queryAll in the referenced DOM spec? Thanks, - Reece > I suggest you think carefully about how you would implement the "id selector > only matches the first node in the DOM with that id" behavior in the "here > is a node, find all the selectors that match it" problem. > > -Boris >
Received on Wednesday, 8 April 2015 15:43:20 UTC