dciccale / grunt-processhtml

Process html files at build time to modify them depending on the release environment
MIT License
407 stars 30 forks source link

Can I add attribute "scoped" to style element (:css inline)? #91

Closed genesis-dev closed 8 years ago

genesis-dev commented 8 years ago

By HTML5 specification tag "style" that is not child of "head" must have this attribute (W3C validator finds an error).

dciccale commented 8 years ago

the scoped attribute is not required.

The scoped attribute is a boolean attribute. If set, it indicates that the styles are intended just for the subtree rooted at the style element’s parent element, as opposed to the whole Document. — WHATWG

https://html.spec.whatwg.org/multipage/semantics.html#attr-style-scoped

is a boolean attribute, meaning it can be present or not. and in case it is present, meaning true, styles will only apply to the subtree starting from the style parent element.

i don't have much experience in w3c validator, maybe there is some option to allow you use it without the scoped attribute. Be careful with this, because that attribute will actually make your style element behave different if it is present or not.

however, I will add this issue as a possible feature to allow setting the attribute.

genesis-dev commented 8 years ago

Thanks!

dciccale commented 8 years ago

fixed in https://github.com/dciccale/node-htmlprocessor/commit/e0f25fdc22b5d7567cc60bf08350b11f9e23d5ce