W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: QSA, the problem with ":scope", and naming

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Wed, 19 Oct 2011 14:17:14 +0200
Message-ID: <4E9EBFCA.1060709@lachy.id.au>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: Sean Hogan <shogun70@westnet.com.au>, Yehuda Katz <wycats@gmail.com>, Alex Russell <slightlyoff@google.com>, Webapps WG <public-webapps@w3.org>, John Resig <jeresig@gmail.com>, Paul Irish <paulirish@google.com>
On 2011-10-19 01:58, Tab Atkins Jr. wrote:
> Based on discussion on the mailing list,<style scoped>  will be
> changing to the latter behavior as well, with the ability to invoke
> the former behavior in the rare circumstances when you explicitly want
> it.

Despite some similarities in appearance, the proposed changes to <style 
scoped> will still use selectors differently from that proposed here for 
a new findAll() method.

1. Syntax

In <style scoped>, selectors still can't begin with a combinator, but in 
the proposed API, they can.

The @global at-rule was proposed to

2. Matching the Context Element

In scoped stylesheets, the context element itself can be the subject of 
a selector. But the proposed API will never return the element itself in 
the result.

div.findAll("div") // Does not match the element itself

(same as querySelectorAll() in this case)

   <style scoped>
     div { ... } /* Matches the context element */

3. The Subject of Selectors

In scoped stylesheets, the potential matches of a selector will only 
* The context element itself
* Descendants of the context element

In the proposed API, the potential matches will include:
* Descendants of the context element
* Siblings of the context element

In the existing API, the potential matches include:
* Descendants of the context element only

div.findAll("+p") // Matches sibling p elements

div.querySelectorAll(":scope+p") // Matches nothing
document.querySelectorAll(":scope+p", div) // Matches sibling p elements

   <style scoped>
     :scope+p { ... } /* Matches nothing */

Lachlan Hunt - Opera Software
Received on Wednesday, 19 October 2011 12:17:45 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:36 UTC