Skip to content
Navigation Menu
Appearance settings
AI CODE CREATION
GitHub CopilotWrite better code with AI
GitHub SparkBuild and deploy intelligent apps
GitHub ModelsManage and compare prompts
MCP RegistryNewIntegrate external tools
DEVELOPER WORKFLOWS
ActionsAutomate any workflow
CodespacesInstant dev environments
IssuesPlan and track work
Code ReviewManage code changes
APPLICATION SECURITY
GitHub Advanced SecurityFind and fix vulnerabilities
Code securitySecure your code as you build
Secret protectionStop leaks before they start
EXPLORE
●Why GitHub
●Documentation
●Blog
●Changelog
●Marketplace
View all features
BY COMPANY SIZE
●Enterprises
●Small and medium teams
●Startups
●Nonprofits
BY USE CASE
●App Modernization
●DevSecOps
●DevOps
●CI/CD
●View all use cases
BY INDUSTRY
●Healthcare
●Financial services
●Manufacturing
●Government
●View all industries
View all solutions
EXPLORE BY TOPIC
●AI
●Software Development
●DevOps
●Security
●View all topics
EXPLORE BY TYPE
●Customer stories
●Events & webinars
●Ebooks & reports
●Business insights
●GitHub Skills
SUPPORT & SERVICES
●Documentation
●Customer support
●Community forum
●Trust center
●Partners
COMMUNITY
GitHub SponsorsFund open source developers
PROGRAMS
●Security Lab
●Maintainer Community
●Accelerator
●Archive Program
REPOSITORIES
●Topics
●Trending
●Collections
ENTERPRISE SOLUTIONS
Enterprise platformAI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced SecurityEnterprise-grade security features
Copilot for BusinessEnterprise-grade AI features
Premium SupportEnterprise-grade 24/7 support
●Pricing
Search or jump to...
Clear
Search syntax tips
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
To see all available qualifiers, see our documentation.
Appearance settings
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
thingsinjars
/
jQuery-Scoped-CSS-plugin
Public
●
Notifications
You must be signed in to change notification settings
●
Fork
35
Star
168
DEPRECATED: A jQuery plugin to enable the scoped attribute on style blocks
thingsinjars.com/post/359/css-scoped/
License
MIT license
168
stars
35
forks
Branches
Tags
Activity
Star
Notifications
You must be signed in to change notification settings
●
Code
●
Issues
10
●
Pull requests
0
●
Actions
●
Projects
0
●
Wiki
●
Security
0
●
Insights
Additional navigation options
●
Code
●
Issues
●
Pull requests
●
Actions
●
Projects
●
Wiki
●
Security
●
Insights
thingsinjars/jQuery-Scoped-CSS-plugin
master
BranchesTags
Open more actions menu
Folders and files
Repository files navigation
●README
●MIT license
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.
●Check out the spec on the W3C site
●Read more about the plugin
●Demo of the plugin in action
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
●If you're using multiple nested declarations, Webkit might apply different inheritance specificity rules from the other engines. I don't know who's right.
●Remember, IE < 9 support requires a helping hand if you're using HTML 5 elements
●Currently, getElementStyles is hand-rolled and possibly wrong.
●Sometimes there are delays parsing externally loaded stylesheets (via @import) and they might get skipped. Not often but it happens.
Notes
●If the browser natively supports style scoped, this will return without doing anything
●Style elements really shouldn't have classes added to them. This bit of the functionality should probably use some kind of data attribute.
●The scoped blocks are emptied out for non-IE browsers because currently only IE supports the 'disabled' attribute.
●Opera exhibits a short delay (~20ms) when resolving styles included via @import. There's a forced delay to counter this.
●Opera seems to add an extra content:none on text nodes.
About
DEPRECATED: A jQuery plugin to enable the scoped attribute on style blocks
thingsinjars.com/post/359/css-scoped/
Resources
Readme
License
MIT license
Uh oh!
There was an error while loading. Please reload this page.
Activity
Stars
168
stars
Watchers
7
watching
Forks
35
forks
Report repository
No releases published
No packages published
Languages
●
JavaScript
79.5%
●
HTML
20.3%
●
CSS
0.2%
Footer
© 2026 GitHub, Inc.
●
Terms
●
Privacy
●
Security
●
Status
●
Community
●
Docs
●
Contact
●
●
ation
You can’t perform that action at this time.