Git Product home page Git Product logo

csscope's People

Contributors

zbryikt avatar

Watchers

 avatar  avatar

csscope's Issues

conflict between `:not` and `:before`

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.

parent CSS affects children CSS

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:

https://codepen.io/tkirby/pen/poEdNRw

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.