[webkit-dev] Implementing <style scoped>

Maciej Stachowiak mjs at apple.com
Mon Sep 12 16:11:24 PDT 2011

On Sep 8, 2011, at 2:28 PM, Roland Steiner wrote:

> Hi all,
> After several discussions on the whatwg@ mailing list and others, we would like to go forward with adding <style scoped> to WebKit.
> Overview:
> Style rules within <style scoped> only apply to the parent element of <style scoped> (the scoping element), as well as descendants of it. Any other nodes are unaffected. This allows authors to style specific parts of a page without requiring ID prefixes. It also has potential performance benefits, as scoped rules do not need to be evaluated outside their scope.
> As per discussion on http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-June/032056.html, our implementation would diverge from the current HTML5 spec (http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-style-element) in that we would match selectors only up to, and including, the scoping element. E.g.,:

It sounds like there wasn't consensus to make this spec change. In particular, Hixie's last comments seemed to disagree with the proposed change. My preferences would be:

1. Implement what the spec says rather than diverging.
2. Get the spec actually changed, or at least agreement in principle to change the spec, then implement the proposed behavior.
3. Make sure to webkit prefix it and maybe even call the attribute something other than "scoped" if we are not confident of the spec change coming through.

It's definitely *not* ok to call the attribute "scoped" but not match what the spec says, in my opinion.

I would strongly prefer #1 or #2 to #3. I don't have any particular opinion on the substantive issue, but I don't think we should just diverge without agreement from others.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110912/6d526c77/attachment.html>

More information about the webkit-dev mailing list