scoped-polyfill
scoped-polyfill copied to clipboard
scoped styles not applied to scoping element itself
Scoped styles aren't applied to the scoping element itself (e.g., #scopedByScopedPolyfill_1), just to its children. See: http://stackoverflow.com/questions/19538711/html5-scoped-styles-on-parent-scoping-element
+1 I ended up just programmatically wrapping the parent element and then moving the style element into the wrapper before running the polyfill. It would be great if this worked like the spec, though.
@benmarch, I ended up creating a polyfill that should work close to spec, including support for :scope selector for parent element:
https://github.com/thomaspark/scoper/
Thanks, @thomaspark, that looks great! The only issue is that my company still supports IE8, which is the only reason I chose this polyfill (I was originally using another one that didn't work in IE8 or 9). If you are interested, I could create a PR for scoper that would make it IE8 compatible--after a quick glance at your source code, it looks like it would be fairly straight-forward. For reference, I am using this in an AngularJS library to dynamically add scoped styles to components and directives.
Hey @benmarch, sure, if it's pretty straightforward, I'd be interested in a PR to add IE8 support.