thingsinjars / jQuery-Scoped-CSS-plugin

DEPRECATED: A jQuery plugin to enable the scoped attribute on style blocks
http://thingsinjars.com/post/359/css-scoped/
MIT License
168 stars 37 forks source link

DEPRECATED

This project is no longer maintained. If there's anything useful here, feel free to take it.

jQuery Scoped CSS plugin

This adds support for the scoped attribute to limit a block of style declarations to a specific area of the HTML. You can also use @import and media filters in scoped blocks.

Use

Include this plugin file (minified, ideally) and call $.scoped() on load. If you add style blocks to the page later, you need to rerun the plugin.

Any style blocks with the scoped attribute are processed and limited to only affect their parent's children:

<p>This will be black.</p>
<section>
 <style scoped>
   p {color:red;}
 </style> 
 <p>This will be red.</p>
</section>

Limitations

Notes