plotdb / csscope Goto Github PK
View Code? Open in Web Editor NEWadd custom scope to any css. Use browser thus only works in browsers.
add custom scope to any css. Use browser thus only works in browsers.
say for scoping in hierarchy we use [scope]
selector for scoping test, thus csscope generates css with :not([scope])
selector. This may apply to rules with pseudo elements ( :before
) - but it just doesn't work:
something::before:not([scope]) /* this won't work, and will break this rule */
however we simply don't need :not([scope])
for pseudo elements since they can never be targets for matching scope test.
We can simply ignore the scope test for pseudo elements to resolve this issue.
scoped CSS affects all nodes under the scoped root, even if some children have their own scopes.
possible solution is to add not
pseudo class:
/* original css
div {background: #0f0; } /* for div[scope=s1] */
div {background: #f00; } /* for div[scope=s2] */
*/
/* converted css */
div[scope=s1] :not([scope]) div {background: #f00; }
div[scope=s1] > div:not([scope]) {background: #f00; } /* can be written as one line. separate for clarity. */
div[scope=s2] :not([scope]) div {background: #0f0; }
div[scope=s2] > div:not([scope]) {background: #0f0; }
live sample code available here:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.