[whatwg] Selectors within <style scoped>

On Thu, Jun 16, 2011 at 3:19 PM, Lachlan Hunt <lachlan.hunt at lachy.id.au> wrote:
> On 2011-06-16 19:40, Tab Atkins Jr. wrote:
>> I was convinced that @scoped worked exactly like this until this
>> thread. ?Apparently my previous reading of the spec was insufficiently
>> deep to spot the scoping/filtering difference.
>>
>> FWIW, I also think that querySelector got this wrong. ?It should have
>> scoped by default, and then possibly also offered an option to filter
>> based on an element.
>
> I analysed this issue in depth when I wrote Selectors API, and even
> revisited it when I tried to introduce the queryScopedSelector methods. ?But
> it doesn't work without altering the syntax of selectors, like JQuery does,
> such as allowing selectors to begin with combinators and creates other
> unintended side affects. ?I don't have time to write up a full explanation
> now, but most of the rationale is somewhere in the public-webapps archives.

The side-effect you mention (having to allow selectors to start with
combinators) is not a problem in Dimitry's proposal, where :scope is
defined and added to :scope-less selectors at parse-time.

I don't recall what the other issues were, but I'd appreciate a more
permanent explanation of the issues you ran into than a mailing list
archive.  ^_^

~TJ

Received on Thursday, 16 June 2011 15:22:37 UTC