- From: Chris Eppstein via GitHub <sysbot+gh@w3.org>
- Date: Mon, 26 Aug 2019 21:47:01 +0000
- To: public-css-archive@w3.org
> That is, if a stylesheet opts into namespacing as a <link> attribute, it should do so under a single namespace. I'm not sure how stylesheet concatenation tools would work in this situation where there are two different namespaced definitions of the same ident but having distinct meanings that shouldn't collide and end up accidentally matching the same elements. > then you get into weird cases where the browser doesn't know what to do with `buttons:type="text" links:type="text" call-to-action:type="submit"`. These would have no effect in the browser except to provide hooks for styling. If you wanted the browser button to have a `type=submit` you'd have to have that attribute in the html namespace. The stylesheets could select the type attribute in the html namespace with `[type=submit]` and a stylesheet could select the the `links:type` attribute with the namespaced attribute selector: `[links|type="text"]`. A stylesheet could even select elements at the intersection of these namespaces with something like `[type="submit][call-to-action|type="submit"]`. > So, in other words, this pattern breaks if your CSS contains anything other than classes, such as trying to style all <p> tags within a local tree. It doesn't. here's how that would work: ```css @namespace local(); :scope p { color: darkgray; font-size: 16px; } ``` ```html <link rel="namespaced stylesheet" namespace="markdown"> <div id="markdown-container" markdown:class> <!-- transformed from markdown --> <p>This text is dark gray and has a font size of 16px.</p> </div> ``` > Your proposal seems to clash with the fundamentals of CSS (and possibly the DOM?). I must be doing a bad job at describing it then, because there's actually very few new things that I'm proposing here, it's just using document namespaces and syntaxes that the browser already has, to provide some convenience features to make it easier to leverage those things in the context of a css file. > We can't assume / force that people would only work with classes, and not IDs, element names, or attribute selectors when scoping their styles. I agree. I didn't make that assumption. My proposal didn't mention attribute selectors nor tag names because they already work with namespaces in css and in html. -- GitHub Notification of comment by chriseppstein Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4061#issuecomment-525046203 using your GitHub account
Received on Monday, 26 August 2019 21:47:04 UTC