This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 19995 - StyleSheet interface should have a "scoped" IDL attribute
Summary: StyleSheet interface should have a "scoped" IDL attribute
Status: RESOLVED WONTFIX
Alias: None
Product: CSS
Classification: Unclassified
Component: CSSOM (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Simon Pieters
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on: 19874
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-18 06:41 UTC by Cameron McCormack
Modified: 2013-08-08 13:26 UTC (History)
1 user (show)

See Also:


Attachments

Description Cameron McCormack 2012-11-18 06:41:21 UTC
I think it would be good to reflect in a StyleSheet object whether it is scoped to an element (via a scoped="" attribute on a <style> element).  Might also be worth exposing what the scope root is.
Comment 1 Glenn Adams 2012-11-18 15:35:06 UTC
Needs to be coordinated with bug 19874.
Comment 2 Simon Pieters 2013-06-27 13:41:57 UTC
Can you elaborate on the use case(s), please?

It's possible to find this out already, something like

StyleSheet.prototype.isScoped = function() {
  return this.ownerNode && !!this.ownerNode.scoped;
};

StyleSheet.prototype.scopedElement = function() {
  if (this.isScoped()) {
    return this.ownerNode.parentElement;
  }
};

This isn't fool-proof, but probably good enough. Since scoped style sheets aren't widely implemented yet, I think it's a bit premature to add this to CSSOM. Let's revisit this when scoped style sheets are widely implemented and used.
Comment 3 Cameron McCormack 2013-06-28 00:50:42 UTC
I am not sure what use case I had in mind when I filed the bug. :)  I didn't know about ownerNode.  Having .scoped on the StyleSheet object is not so necessary given that.
Comment 4 Simon Pieters 2013-06-28 07:48:07 UTC
OK, then I'll mark this as WONTFIX. Feel free to reopen if anyone comes up with a use case.