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/

Reply via email to