Skip to content

I don't understand how scoping works (I read the spec). #10

@trusktr

Description

@trusktr

I read the spec, but I can't understand what "scoping" means, or at least I don't understand what it is useful for.

For example, I would think that in the following example only the p inside of .two is styled:

https://codepen.io/anon/pen/MrmqeX

But instead what I see is something like "Because there exists an element with class .two anywhere on the page, then apply this style in global scope which applies to all elements on the page even if they are outside of the element with class .two".

I was hoping that styles inside of the @element query would apply only to elements that are found inside of the element(s) targeted with @element. This would be similar to nesting in SASS/LESS/Stylus.

Is this not the case? Do you mean to rather do something like "If there is a <video> element anywhere on the page, then style the whole page in some way"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions