W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2019

Re: [csswg-drafts] [css-selectors][css-namespaces] Lexical Scoping (#4061)

From: Chris Eppstein via GitHub <sysbot+gh@w3.org>
Date: Mon, 26 Aug 2019 23:22:19 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-525070769-1566861738-sysbot+gh@w3.org>
@matthew-dean `:scope` is a pseudo-**class** that matches the root element of a stylesheet's scope. To me, the css class attribute feels like good place for that association, but certainly another attribute could be used (E.g. `<div id="markdown-container" markdown:css>`). Basically we have to decide what `:scope` matches when a stylesheet isn't being used in the context of a web component, but it's the same concept as matching the root element of a web component.

> It also clashes with libraries like Vue (and Ractive?) which use XML-namespace-like attributes to change attribute behaviors. Which of course was dangerous on their part, but...

As a person who has made tools that play around in the domain of standards, that's just par for the course, if the browser changes, you adapt.

> why attach the namespace to an arbitrary attribute, instead of defining an attribute where one can attach (select) namespaces

Because there's not just one namespace involved. There's usually an application namespace where things can be unique, but each thirdparty library usually has associated css that really aught to be in its own namespace. If you're using something like bootstrap, all those classes should be in their own namespace. I think the idea of using `<button app:class="my application classes" bootstrap:class="btn btn-primary">` is more clear and quite enticing.

> I think also XML namespacing on an attribute isn't supposed to define the tree behaviors, is it? 

I'm not sure what this means. I'm not defining any tree behaviors that I know of. I'm just proposing an easy way to define a namespace based on the url of a stylesheet. The rest just falls out from that.

-- 
GitHub Notification of comment by chriseppstein
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4061#issuecomment-525070769 using your GitHub account
Received on Monday, 26 August 2019 23:22:21 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:13 UTC