- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Wed, 19 Oct 2011 14:17:14 +0200
- 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)
<div>
<style scoped>
div { ... } /* Matches the context element */
</style>
</div>
3. The Subject of Selectors
In scoped stylesheets, the potential matches of a selector will only
include:
* 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
<div>
<style scoped>
:scope+p { ... } /* Matches nothing */
</style>
<div>
<p>...</p>
--
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/
Received on Wednesday, 19 October 2011 12:17:45 UTC