Last modified: 2013-11-29 08:21:28 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T52644, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 50644 - Support <style scoped> as HTML element in wiki source
Support <style scoped> as HTML element in wiki source
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.22.0
All All
: Lowest enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: html5
  Show dependency treegraph
 
Reported: 2013-07-03 08:10 UTC by Michael[tm] Smith
Modified: 2013-11-29 08:21 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Michael[tm] Smith 2013-07-03 08:10:47 UTC
Enhancement request: Add <style scoped> to the set of HTML elements that can be used in wiki source. That would allow authors to specify styles for all child content of a particular part of a page (element). For example:

<div id="terms">
<style scoped>
ul: { display: table }
li: { display: table-row }
dfn: { display: table-cell }
p.def { display: table-cell }
</style>
<ul>
<li>
<dfn id="scoped">scoped</dfn>
<p.def>A attribute for the "style" element that allows you to include CSS rules within the body of an HTML document but scope those rules just to a particular portion of the document.</p>
</li>
</ul>
</div>
Comment 1 Bartosz Dziewoński 2013-07-03 10:58:59 UTC
<style scoped> is not yet supported by any browsers except for Firefox, and this attribute wouldn't degrade gracefully. It shouldn't be implemented anytime soon.

http://caniuse.com/#feat=style-scoped
Comment 2 Michael[tm] Smith 2013-07-03 11:08:31 UTC
(In reply to comment #1)
> <style scoped> is not yet supported by any browsers except for Firefox,
> http://caniuse.com/#feat=style-scoped

It's implemented in Chrome as well. There's a user option for enabling it. See the note at the bottom of that caniuse page.

> and this attribute wouldn't degrade gracefully.

All CSS degrades pretty gracefully. How gracefully the actual user experience degrades depends on how the content's authored. The example I gave in the description will degrade from being displayed as a table to being displayed as a normal bulleted list.
Comment 3 Bartosz Dziewoński 2013-07-03 11:13:41 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > <style scoped> is not yet supported by any browsers except for Firefox,
> > http://caniuse.com/#feat=style-scoped
> 
> It's implemented in Chrome as well. There's a user option for enabling it.
> See the note at the bottom of that caniuse page.

Yeah, so in other words it's not supported unless someone enables it. That still means it's not supported.


(In reply to comment #2)
> All CSS degrades pretty gracefully. How gracefully the actual user experience
> degrades depends on how the content's authored. The example I gave in the
> description will degrade from being displayed as a table to being displayed
> as a normal bulleted list.

When one disregards the fact that your HTML and CSS are malformatted (<p.def>, trailing colons on selectors) and uses its fixed version in a browser which doesn't support <style scoped>, the styles from it are applies to all elements on the page, even ones outside the scope. So no, it does not degrade gracefully.
Comment 4 Michael[tm] Smith 2013-07-03 11:23:35 UTC
(In reply to comment #3)
> in a browser which
> doesn't support <style scoped>, the styles from it are applies to all
> elements on the page, even ones outside the scope. So no, it does not degrade
> gracefully.

Ah, yeah, you're right. Sorry for the noise -- I should have thought it through a little better.
Comment 5 Fomafix 2013-11-29 08:21:28 UTC
It would be possible to emulate a scoped style for browser without support for scoped styles by changing the selectors to a specific element.

wikicode
<style>
table.wikitable > tr > th,
table.wikitable > * > tr > th {
  background-color: #fee;
}
</style>

is converted to
<style scoped>
#mw-content-text table.wikitable > tr > th,
#mw-content-text table.wikitable > * > tr > th {
  background-color: #fee;
}
</style>

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links