MozillaZine

Question about <style> and <style scoped>

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Pim

User avatar
 
Posts: 2200
Joined: May 17th, 2004, 2:04 pm
Location: Netherlands

Post Posted June 12th, 2016, 11:54 am

What's the official status on <style scoped> at the moment?

According to the MDN page on style, browser support is abysmal, so it shouldn't be used on public webpages because of incompatibility issues.
That much is clear. Not asking about that.

But how about the official definition?
The MDN page says you can use <style> in the head, and <style scoped> in the body (or more formally, anywhere that flow content is possible).
The W3C on the other hand, makes no such distinction; it says you can use <style> in "any element that can contain metadata elements, div, noscript, section, article, aside" and doesn't mention that scoped changes the content category.

So am I missing something?

Oh, I can't get the W3C validator to work with <style scoped>. A quick and dirty test like this

Code: Select all
<!DOCTYPE html>
<title>test</title>
<body>
<p>test 1</p>
<div>
  <style scoped>p {background:lime}</style>
  <p>test 2</p>
</div>

is supposed to validate without errors as far as I understand. But the validator complains about the <style> in the <div>. (Note that it doesn't complain about the scoped attribute.) Again, am I missing something?
Groetjes, Pim

Frenzie

User avatar
 
Posts: 2111
Joined: May 5th, 2004, 10:40 am
Location: Belgium

Post Posted June 14th, 2016, 7:25 am

The validator follows the W3C specification and doesn't necessarily reflect the latest WHATWG (or even W3C) drafts, so there's no surprise there. However, a quick search on the WHATWG spec issues shows that it's been removed because "it's a feature with only one implementation, and no positive signals from any other vendors." A pity, because this sounds potentially quite useful.
Intelligent alien life does exist, otherwise they would have contacted us.

Pim

User avatar
 
Posts: 2200
Joined: May 17th, 2004, 2:04 pm
Location: Netherlands

Post Posted June 14th, 2016, 8:37 am

Oh, it seems you're right. When doing more searching, I also found that the scoped attribute (and the possibility to use <style> in the body) is no longer there in the latest version of the W3C's working draft for HTML (the 2016-06-02 version).

That's definitely a recent development though; it was still present in the previous working draft, from 2016-03-10.

So, thanks! And yes, I was missing something.
Groetjes, Pim

AlfonsoML
 
Posts: 386
Joined: September 6th, 2006, 1:39 pm

Post Posted June 25th, 2016, 1:59 pm

Just for reference, in the future don't bother looking at W3C, go straight to the source and look at the WHATWG because there's where all the work is done and the browser vendors are there.

Pim

User avatar
 
Posts: 2200
Joined: May 17th, 2004, 2:04 pm
Location: Netherlands

Post Posted June 27th, 2016, 8:54 am

But I've always gone to the W3C first. Back in the bad old days when everything was a mess, the W3C stepped in and helped develop real standards. Then after many years of stability, the WHATWG came and said, hey, you're not changing things quickly enough, we need more change! And I'm not convinced that is all good.

Also, I'm not sure if I have forgiven the WHATWG for attempting to un-deprecate <font>.

So if it ever comes to a civil war between them (and let's hope it remains civil!) I'll have to side with the W3C.

Oh, don't get me wrong, I'm not fond of everything the W3C does either. Take "HTML 5.1" for an example. But still.
Groetjes, Pim

AlfonsoML
 
Posts: 386
Joined: September 6th, 2006, 1:39 pm

Post Posted June 27th, 2016, 8:56 am

It's not about what you like or not.
The fact is that the current HTML spec from W3C is a fork (usually outdated) of the version from WHATWG.

Pim

User avatar
 
Posts: 2200
Joined: May 17th, 2004, 2:04 pm
Location: Netherlands

Post Posted June 29th, 2016, 10:27 am

Let's just agree to disagree. On the one hand, it sounds like you're proving my point - the WHATWG is changing things faster than the W3C likes to, and that's too fast for any reasonable stability in my eyes.

On the other hand, the W3C has, for example, deprecated the hgroup element by now, of which the WHATWG still seems to think it's a good idea.

So let's just agree to disagree, OK?
Groetjes, Pim

Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: No registered users and 2 guests