<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.whatwg.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=FrShorts7</id>
	<title>WHATWG Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.whatwg.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=FrShorts7"/>
	<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/wiki/Special:Contributions/FrShorts7"/>
	<updated>2026-04-29T15:49:34Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Sanitization_rules&amp;diff=7595</id>
		<title>Sanitization rules</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Sanitization_rules&amp;diff=7595"/>
		<updated>2011-11-07T21:27:12Z</updated>

		<summary type="html">&lt;p&gt;FrShorts7: None&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page was initially seeded with the sanitization lists and rules implemented by the [http://code.google.com/p/html5lib/ html5lib] sanitizer, which in turn was based on [http://golem.ph.utexas.edu/instiki/show/HomePage Jacques Distler&#039;s branch of Instiki], which in turn was based on the sanitization logic in the [http://www.feedparser.org/ Universal Feed Parser].&lt;br /&gt;
&lt;br /&gt;
It is hoped that others will add, update, and extend this list based on their experiences in their own products, and furthermore that some will update their products based on these lists. One such product is&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://bit.ly/vWV7iJ &amp;lt;span style=&amp;quot;color:black;font-weight:normal;text-decoration:none!important;background:none!important; text-decoration:none;&amp;quot;&amp;gt;weight gain&amp;lt;/span&amp;gt;]&amp;lt;/span&amp;gt;([http://intertwingly.net/stories/2007/08/11/diffs diffs]). Another product is [http://www.bloglines.com/help/css-support bloglines].&lt;br /&gt;
&lt;br /&gt;
As a suggestion but not as a requirement: people who do update their products to reflect information from this list are encouraged to add a link to this page as a comment in the hopes that it will encourage subsequent maintainers to keep this page up to date.&lt;br /&gt;
&lt;br /&gt;
As a convenience, [http://intertwingly.net/stories/2007/08/13/sanitize_lists.cgi this script] ([http://intertwingly.net/stories/2007/08/13/sanitize_lists.rb source]) converts these lists into a syntax shared by a number of common programming languages.&lt;br /&gt;
&lt;br /&gt;
=== Acceptable Elements ===&lt;br /&gt;
&lt;br /&gt;
* a&lt;br /&gt;
* abbr&lt;br /&gt;
* acronym&lt;br /&gt;
* address&lt;br /&gt;
* area&lt;br /&gt;
* b&lt;br /&gt;
* bdo&lt;br /&gt;
* big&lt;br /&gt;
* blockquote&lt;br /&gt;
* br&lt;br /&gt;
* button&lt;br /&gt;
* caption&lt;br /&gt;
* center&lt;br /&gt;
* cite&lt;br /&gt;
* code&lt;br /&gt;
* col&lt;br /&gt;
* colgroup&lt;br /&gt;
* dd&lt;br /&gt;
* del&lt;br /&gt;
* dfn&lt;br /&gt;
* dir&lt;br /&gt;
* div&lt;br /&gt;
* dl&lt;br /&gt;
* dt&lt;br /&gt;
* em&lt;br /&gt;
* fieldset&lt;br /&gt;
* font&lt;br /&gt;
* form&lt;br /&gt;
* h1&lt;br /&gt;
* h2&lt;br /&gt;
* h3&lt;br /&gt;
* h4&lt;br /&gt;
* h5&lt;br /&gt;
* h6&lt;br /&gt;
* hr&lt;br /&gt;
* i&lt;br /&gt;
* img&lt;br /&gt;
* input&lt;br /&gt;
* ins&lt;br /&gt;
* kbd&lt;br /&gt;
* label&lt;br /&gt;
* legend&lt;br /&gt;
* li&lt;br /&gt;
* map&lt;br /&gt;
* menu&lt;br /&gt;
* ol&lt;br /&gt;
* optgroup&lt;br /&gt;
* option&lt;br /&gt;
* p&lt;br /&gt;
* pre&lt;br /&gt;
* q&lt;br /&gt;
* s&lt;br /&gt;
* samp&lt;br /&gt;
* select&lt;br /&gt;
* small&lt;br /&gt;
* span&lt;br /&gt;
* strike&lt;br /&gt;
* strong&lt;br /&gt;
* sub&lt;br /&gt;
* sup&lt;br /&gt;
* table&lt;br /&gt;
* tbody&lt;br /&gt;
* td&lt;br /&gt;
* textarea&lt;br /&gt;
* tfoot&lt;br /&gt;
* th&lt;br /&gt;
* thead&lt;br /&gt;
* tr&lt;br /&gt;
* tt&lt;br /&gt;
* u&lt;br /&gt;
* ul&lt;br /&gt;
* var&lt;br /&gt;
* wbr&lt;br /&gt;
&lt;br /&gt;
==== mathml Elements ====&lt;br /&gt;
&lt;br /&gt;
* maction&lt;br /&gt;
* math&lt;br /&gt;
* merror&lt;br /&gt;
* mfrac&lt;br /&gt;
* mi&lt;br /&gt;
* mmultiscripts&lt;br /&gt;
* mn&lt;br /&gt;
* mo&lt;br /&gt;
* mover&lt;br /&gt;
* mpadded&lt;br /&gt;
* mphantom&lt;br /&gt;
* mprescripts&lt;br /&gt;
* mroot&lt;br /&gt;
* mrow&lt;br /&gt;
* mspace&lt;br /&gt;
* msqrt&lt;br /&gt;
* mstyle&lt;br /&gt;
* msub&lt;br /&gt;
* msubsup&lt;br /&gt;
* msup&lt;br /&gt;
* mtable&lt;br /&gt;
* mtd&lt;br /&gt;
* mtext&lt;br /&gt;
* mtr&lt;br /&gt;
* munder&lt;br /&gt;
* munderover&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==== svg Elements ====&lt;br /&gt;
&lt;br /&gt;
* a&lt;br /&gt;
* animate&lt;br /&gt;
* animateColor&lt;br /&gt;
* animateMotion&lt;br /&gt;
* animateTransform&lt;br /&gt;
* circle&lt;br /&gt;
* defs&lt;br /&gt;
* desc&lt;br /&gt;
* ellipse&lt;br /&gt;
* font-face&lt;br /&gt;
* font-face-name&lt;br /&gt;
* font-face-src&lt;br /&gt;
* g&lt;br /&gt;
* glyph&lt;br /&gt;
* hkern&lt;br /&gt;
* image&lt;br /&gt;
* linearGradient&lt;br /&gt;
* line&lt;br /&gt;
* marker&lt;br /&gt;
* metadata&lt;br /&gt;
* missing-glyph&lt;br /&gt;
* mpath&lt;br /&gt;
* path&lt;br /&gt;
* polygon&lt;br /&gt;
* polyline&lt;br /&gt;
* radialGradient&lt;br /&gt;
* rect&lt;br /&gt;
* set&lt;br /&gt;
* stop&lt;br /&gt;
* svg&lt;br /&gt;
* switch&lt;br /&gt;
* text&lt;br /&gt;
* title&lt;br /&gt;
* tspan&lt;br /&gt;
* use&lt;br /&gt;
&lt;br /&gt;
=== Acceptable Attributes ===&lt;br /&gt;
&lt;br /&gt;
* abbr&lt;br /&gt;
* accept&lt;br /&gt;
* accept-charset&lt;br /&gt;
* accesskey&lt;br /&gt;
* action&lt;br /&gt;
* align&lt;br /&gt;
* alt&lt;br /&gt;
* axis&lt;br /&gt;
* border&lt;br /&gt;
* cellpadding&lt;br /&gt;
* cellspacing&lt;br /&gt;
* char&lt;br /&gt;
* charoff&lt;br /&gt;
* charset&lt;br /&gt;
* checked&lt;br /&gt;
* cite&lt;br /&gt;
* class&lt;br /&gt;
* clear&lt;br /&gt;
* cols&lt;br /&gt;
* colspan&lt;br /&gt;
* color&lt;br /&gt;
* compact&lt;br /&gt;
* coords&lt;br /&gt;
* datetime&lt;br /&gt;
* dir&lt;br /&gt;
* disabled&lt;br /&gt;
* enctype&lt;br /&gt;
* for&lt;br /&gt;
* frame&lt;br /&gt;
* headers&lt;br /&gt;
* height&lt;br /&gt;
* href&lt;br /&gt;
* hreflang&lt;br /&gt;
* hspace&lt;br /&gt;
* id&lt;br /&gt;
* ismap&lt;br /&gt;
* label&lt;br /&gt;
* lang&lt;br /&gt;
* longdesc&lt;br /&gt;
* maxlength&lt;br /&gt;
* media&lt;br /&gt;
* method&lt;br /&gt;
* multiple&lt;br /&gt;
* name&lt;br /&gt;
* nohref&lt;br /&gt;
* noshade&lt;br /&gt;
* nowrap&lt;br /&gt;
* prompt&lt;br /&gt;
* readonly&lt;br /&gt;
* rel&lt;br /&gt;
* rev&lt;br /&gt;
* rows&lt;br /&gt;
* rowspan&lt;br /&gt;
* rules&lt;br /&gt;
* scope&lt;br /&gt;
* selected&lt;br /&gt;
* shape&lt;br /&gt;
* size&lt;br /&gt;
* span&lt;br /&gt;
* src&lt;br /&gt;
* start&lt;br /&gt;
* style&lt;br /&gt;
* summary&lt;br /&gt;
* tabindex&lt;br /&gt;
* target&lt;br /&gt;
* title&lt;br /&gt;
* type&lt;br /&gt;
* usemap&lt;br /&gt;
* valign&lt;br /&gt;
* value&lt;br /&gt;
* vspace&lt;br /&gt;
* width&lt;br /&gt;
* xml:lang&lt;br /&gt;
&lt;br /&gt;
==== mathml Attributes ====&lt;br /&gt;
&lt;br /&gt;
* actiontype&lt;br /&gt;
* align&lt;br /&gt;
* columnalign&lt;br /&gt;
* columnalign&lt;br /&gt;
* columnalign&lt;br /&gt;
* columnlines&lt;br /&gt;
* columnspacing&lt;br /&gt;
* columnspan&lt;br /&gt;
* depth&lt;br /&gt;
* display&lt;br /&gt;
* displaystyle&lt;br /&gt;
* equalcolumns&lt;br /&gt;
* equalrows&lt;br /&gt;
* fence&lt;br /&gt;
* fontstyle&lt;br /&gt;
* fontweight&lt;br /&gt;
* frame&lt;br /&gt;
* height&lt;br /&gt;
* linethickness&lt;br /&gt;
* lspace&lt;br /&gt;
* mathbackground&lt;br /&gt;
* mathcolor&lt;br /&gt;
* mathvariant&lt;br /&gt;
* mathvariant&lt;br /&gt;
* maxsize&lt;br /&gt;
* minsize&lt;br /&gt;
* other&lt;br /&gt;
* rowalign&lt;br /&gt;
* rowalign&lt;br /&gt;
* rowalign&lt;br /&gt;
* rowlines&lt;br /&gt;
* rowspacing&lt;br /&gt;
* rowspan&lt;br /&gt;
* rspace&lt;br /&gt;
* scriptlevel&lt;br /&gt;
* selection&lt;br /&gt;
* separator&lt;br /&gt;
* stretchy&lt;br /&gt;
* width&lt;br /&gt;
* width&lt;br /&gt;
* xlink:href&lt;br /&gt;
* xlink:show&lt;br /&gt;
* xlink:type&lt;br /&gt;
* xmlns&lt;br /&gt;
* xmlns:xlink&lt;br /&gt;
&lt;br /&gt;
==== svg Attributes ====&lt;br /&gt;
&lt;br /&gt;
* accent-height&lt;br /&gt;
* accumulate&lt;br /&gt;
* additive&lt;br /&gt;
* alphabetic&lt;br /&gt;
* arabic-form&lt;br /&gt;
* ascent&lt;br /&gt;
* attributeName&lt;br /&gt;
* attributeType&lt;br /&gt;
* baseProfile&lt;br /&gt;
* bbox&lt;br /&gt;
* begin&lt;br /&gt;
* by&lt;br /&gt;
* calcMode&lt;br /&gt;
* cap-height&lt;br /&gt;
* class&lt;br /&gt;
* color&lt;br /&gt;
* color-rendering&lt;br /&gt;
* content&lt;br /&gt;
* cx&lt;br /&gt;
* cy&lt;br /&gt;
* d&lt;br /&gt;
* dx&lt;br /&gt;
* dy&lt;br /&gt;
* descent&lt;br /&gt;
* display&lt;br /&gt;
* dur&lt;br /&gt;
* end&lt;br /&gt;
* fill&lt;br /&gt;
* fill-rule&lt;br /&gt;
* font-family&lt;br /&gt;
* font-size&lt;br /&gt;
* font-stretch&lt;br /&gt;
* font-style&lt;br /&gt;
* font-variant&lt;br /&gt;
* font-weight&lt;br /&gt;
* from&lt;br /&gt;
* fx&lt;br /&gt;
* fy&lt;br /&gt;
* g1&lt;br /&gt;
* g2&lt;br /&gt;
* glyph-name&lt;br /&gt;
* gradientUnits&lt;br /&gt;
* hanging&lt;br /&gt;
* height&lt;br /&gt;
* horiz-adv-x&lt;br /&gt;
* horiz-origin-x&lt;br /&gt;
* id&lt;br /&gt;
* ideographic&lt;br /&gt;
* k&lt;br /&gt;
* keyPoints&lt;br /&gt;
* keySplines&lt;br /&gt;
* keyTimes&lt;br /&gt;
* lang&lt;br /&gt;
* marker-end&lt;br /&gt;
* marker-mid&lt;br /&gt;
* marker-start&lt;br /&gt;
* markerHeight&lt;br /&gt;
* markerUnits&lt;br /&gt;
* markerWidth&lt;br /&gt;
* mathematical&lt;br /&gt;
* max&lt;br /&gt;
* min&lt;br /&gt;
* name&lt;br /&gt;
* offset&lt;br /&gt;
* opacity&lt;br /&gt;
* orient&lt;br /&gt;
* origin&lt;br /&gt;
* overline-position&lt;br /&gt;
* overline-thickness&lt;br /&gt;
* panose-1&lt;br /&gt;
* path&lt;br /&gt;
* pathLength&lt;br /&gt;
* points&lt;br /&gt;
* preserveAspectRatio&lt;br /&gt;
* r&lt;br /&gt;
* refX&lt;br /&gt;
* refY&lt;br /&gt;
* repeatCount&lt;br /&gt;
* repeatDur&lt;br /&gt;
* requiredExtensions&lt;br /&gt;
* requiredFeatures&lt;br /&gt;
* restart&lt;br /&gt;
* rotate&lt;br /&gt;
* rx&lt;br /&gt;
* ry&lt;br /&gt;
* slope&lt;br /&gt;
* stemh&lt;br /&gt;
* stemv&lt;br /&gt;
* stop-color&lt;br /&gt;
* stop-opacity&lt;br /&gt;
* strikethrough-position&lt;br /&gt;
* strikethrough-thickness&lt;br /&gt;
* stroke&lt;br /&gt;
* stroke-dasharray&lt;br /&gt;
* stroke-dashoffset&lt;br /&gt;
* stroke-linecap&lt;br /&gt;
* stroke-linejoin&lt;br /&gt;
* stroke-miterlimit&lt;br /&gt;
* stroke-opacity&lt;br /&gt;
* stroke-width&lt;br /&gt;
* systemLanguage&lt;br /&gt;
* target&lt;br /&gt;
* text-anchor&lt;br /&gt;
* to&lt;br /&gt;
* transform&lt;br /&gt;
* type&lt;br /&gt;
* u1&lt;br /&gt;
* u2&lt;br /&gt;
* underline-position&lt;br /&gt;
* underline-thickness&lt;br /&gt;
* unicode&lt;br /&gt;
* unicode-range&lt;br /&gt;
* units-per-em&lt;br /&gt;
* values&lt;br /&gt;
* version&lt;br /&gt;
* viewBox&lt;br /&gt;
* visibility&lt;br /&gt;
* width&lt;br /&gt;
* widths&lt;br /&gt;
* x&lt;br /&gt;
* x-height&lt;br /&gt;
* x1&lt;br /&gt;
* x2&lt;br /&gt;
* xlink:actuate&lt;br /&gt;
* xlink:arcrole&lt;br /&gt;
* xlink:href&lt;br /&gt;
* xlink:role&lt;br /&gt;
* xlink:show&lt;br /&gt;
* xlink:title&lt;br /&gt;
* xlink:type&lt;br /&gt;
* xml:base&lt;br /&gt;
* xml:lang&lt;br /&gt;
* xml:space&lt;br /&gt;
* xmlns&lt;br /&gt;
* xmlns:xlink&lt;br /&gt;
* y&lt;br /&gt;
* y1&lt;br /&gt;
* y2&lt;br /&gt;
* zoomAndPan&lt;br /&gt;
&lt;br /&gt;
=== CSS Rules ===&lt;br /&gt;
&lt;br /&gt;
First &amp;lt;code&amp;gt;urls&amp;lt;/code&amp;gt; matching the following regular expression are removed:&lt;br /&gt;
  &amp;lt;pre&amp;gt;url\s*\(\s*[^\s)]+?\s*\)\s*&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The style strings that don&#039;t match the following are deemed obfuscated, and ignored entirely:&lt;br /&gt;
  &amp;lt;pre&amp;gt;^([:,;#%.\sa-zA-Z0-9!]|\w-\w|&#039;[\s\w]+&#039;|&amp;quot;[\s\w]+&amp;quot;|\([\d,\s]+\))*$&amp;lt;/pre&amp;gt;&lt;br /&gt;
  &amp;lt;pre&amp;gt;^(\s*[-\w]+\s*:\s*[^:;]*(;|$))*$&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== style Properties ====&lt;br /&gt;
&lt;br /&gt;
* azimuth&lt;br /&gt;
* background, background-*&lt;br /&gt;
* border, border-*&lt;br /&gt;
* clear&lt;br /&gt;
* color&lt;br /&gt;
* cursor&lt;br /&gt;
* direction&lt;br /&gt;
* display&lt;br /&gt;
* elevation&lt;br /&gt;
* float&lt;br /&gt;
* font&lt;br /&gt;
* font-family&lt;br /&gt;
* font-size&lt;br /&gt;
* font-style&lt;br /&gt;
* font-variant&lt;br /&gt;
* font-weight&lt;br /&gt;
* height&lt;br /&gt;
* letter-spacing&lt;br /&gt;
* line-height&lt;br /&gt;
* margin, margin-*&lt;br /&gt;
* overflow&lt;br /&gt;
* padding, padding-*&lt;br /&gt;
* pause&lt;br /&gt;
* pause-after&lt;br /&gt;
* pause-before&lt;br /&gt;
* pitch&lt;br /&gt;
* pitch-range&lt;br /&gt;
* richness&lt;br /&gt;
* speak&lt;br /&gt;
* speak-header&lt;br /&gt;
* speak-numeral&lt;br /&gt;
* speak-punctuation&lt;br /&gt;
* speech-rate&lt;br /&gt;
* stress&lt;br /&gt;
* text-align&lt;br /&gt;
* text-decoration&lt;br /&gt;
* text-indent&lt;br /&gt;
* unicode-bidi&lt;br /&gt;
* vertical-align&lt;br /&gt;
* voice-family&lt;br /&gt;
* volume&lt;br /&gt;
* white-space&lt;br /&gt;
* width&lt;br /&gt;
&lt;br /&gt;
==== style Property Values ====&lt;br /&gt;
&lt;br /&gt;
* auto&lt;br /&gt;
* aqua&lt;br /&gt;
* black&lt;br /&gt;
* block&lt;br /&gt;
* blue&lt;br /&gt;
* bold&lt;br /&gt;
* both&lt;br /&gt;
* bottom&lt;br /&gt;
* brown&lt;br /&gt;
* center&lt;br /&gt;
* collapse&lt;br /&gt;
* dashed&lt;br /&gt;
* dotted&lt;br /&gt;
* fuchsia&lt;br /&gt;
* gray&lt;br /&gt;
* green&lt;br /&gt;
* !important&lt;br /&gt;
* italic&lt;br /&gt;
* left&lt;br /&gt;
* lime&lt;br /&gt;
* maroon&lt;br /&gt;
* medium&lt;br /&gt;
* none&lt;br /&gt;
* navy&lt;br /&gt;
* normal&lt;br /&gt;
* nowrap&lt;br /&gt;
* olive&lt;br /&gt;
* pointer&lt;br /&gt;
* purple&lt;br /&gt;
* red&lt;br /&gt;
* right&lt;br /&gt;
* solid&lt;br /&gt;
* silver&lt;br /&gt;
* teal&lt;br /&gt;
* top&lt;br /&gt;
* transparent&lt;br /&gt;
* underline&lt;br /&gt;
* white&lt;br /&gt;
* yellow&lt;br /&gt;
&lt;br /&gt;
In addition, values that match the following regular expression are valid:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== svg style Properties ====&lt;br /&gt;
&lt;br /&gt;
* fill&lt;br /&gt;
* fill-opacity&lt;br /&gt;
* fill-rule&lt;br /&gt;
* stroke&lt;br /&gt;
* stroke-width&lt;br /&gt;
* stroke-linecap&lt;br /&gt;
* stroke-linejoin&lt;br /&gt;
* stroke-opacity&lt;br /&gt;
&lt;br /&gt;
=== URIs ===&lt;br /&gt;
==== Attributes whose value is a URI ====&lt;br /&gt;
&lt;br /&gt;
* href&lt;br /&gt;
* src&lt;br /&gt;
* cite&lt;br /&gt;
* action&lt;br /&gt;
* longdesc&lt;br /&gt;
* xlink:href&lt;br /&gt;
* xml:base&lt;br /&gt;
&lt;br /&gt;
==== URI schemes ====&lt;br /&gt;
&lt;br /&gt;
* afs&lt;br /&gt;
* aim&lt;br /&gt;
* callto&lt;br /&gt;
* data (see [[#Safe data URL content types]])&lt;br /&gt;
* ed2k&lt;br /&gt;
* feed&lt;br /&gt;
* ftp&lt;br /&gt;
* gopher&lt;br /&gt;
* http&lt;br /&gt;
* https&lt;br /&gt;
* irc&lt;br /&gt;
* mailto&lt;br /&gt;
* news&lt;br /&gt;
* nntp&lt;br /&gt;
* rsync&lt;br /&gt;
* rtsp&lt;br /&gt;
* sftp&lt;br /&gt;
* ssh&lt;br /&gt;
* tag&lt;br /&gt;
* tel&lt;br /&gt;
* telnet&lt;br /&gt;
* urn&lt;br /&gt;
* webcal&lt;br /&gt;
* wtai&lt;br /&gt;
* xmpp&lt;br /&gt;
&lt;br /&gt;
==== Safe data URL content types ====&lt;br /&gt;
Note: This section is being [http://wiki.whatwg.org/wiki/Talk:Sanitization_rules discussed].&lt;br /&gt;
* text/plain&lt;br /&gt;
* image/gif&lt;br /&gt;
* image/jpeg&lt;br /&gt;
* image/png&lt;/div&gt;</summary>
		<author><name>FrShorts7</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_CSS_Brainstorming&amp;diff=7594</id>
		<title>Component Model CSS Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_CSS_Brainstorming&amp;diff=7594"/>
		<updated>2011-11-07T21:25:07Z</updated>

		<summary type="html">&lt;p&gt;FrShorts7: None&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Selectors Crossing Boundaries =&lt;br /&gt;
&lt;br /&gt;
Style rules from the host element&#039;s DOM tree are not normally allowed to cross into the shadow DOM. Conversely, style rules defined in the shadow tree are not normally allowed to cross over the content boundary back into the host element&#039;s tree.&lt;br /&gt;
&lt;br /&gt;
== The XBL way ==&lt;br /&gt;
&lt;br /&gt;
The following is the the current &amp;quot;state of the art&amp;quot;, but suffers from various drawbacks&lt;br /&gt;
&lt;br /&gt;
XBL defines the &#039;&#039;allow-selectors-through&#039;&#039; and &#039;&#039;apply-author-sheets&#039;&#039; attributes on the binding template.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;allow-selectors-through&#039;&#039;&#039; allows style selectors defined for the outer tree to cross the boundary into the shadow tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;apply-author-sheets&#039;&#039;&#039; allows style rules defined for the outer tree to be applied entirely inside the shadow tree.&lt;br /&gt;
&lt;br /&gt;
XBL furthermore defines the &#039;&#039;&#039;apply-binding-sheets&#039;&#039;&#039; attribute on content elements. If set, this allows style rules defined for the shadow tree to apply to the host element&#039;s children that are selected by that content element.&lt;br /&gt;
&lt;br /&gt;
Finally, XBL defines the pseudo attribute on elements inside the shadow tree. Its content is an ID that then can be used in outside style rules as pseudo-element in order to style that element specifically. E.g., a &amp;lt;div pseudo=&amp;quot;label&amp;quot;&amp;gt; inside a &amp;quot;x-foo&amp;quot; component could be styled by an outside rule &#039;x-foo::label { color: red; }&#039;.&lt;br /&gt;
&lt;br /&gt;
The XBL approach has several drawbacks:&lt;br /&gt;
&lt;br /&gt;
* It&#039;s an HTML solution to a CSS problem.&lt;br /&gt;
* allow-selectors-through, apply-author-sheets and apply-binding-sheets break confinement.&lt;br /&gt;
* allow-selectors-through and apply-author-sheets do not allow control over what kind of styles attributes to apply/let through.&lt;br /&gt;
* pseudo-IDs are either very limited (XBL proposes to allow only value, choices, label, repeat-item and icon), or pollute the CSS pseudo-element namespace. If allowed arbitrarily they may clash across components, which would makes it hard for the CSS working group to define new pseudo-elements.&lt;br /&gt;
* It is not clear whether the same pseudo-ID could be applied to several different elements&lt;br /&gt;
* Associating a pseudo-ID with a specific element (elements?) makes it harder to later re-design the component without breaking using sites.&lt;br /&gt;
* Pseudo-IDs allow selectors like x-foo::label div { color: red; } to style arbitrary elements of the shadow tree rather than just the designated element(s). This again makes it harder for component authors to later redesign components without breaking user sites.&lt;br /&gt;
&lt;br /&gt;
== Using pseudo-attributes and CSS apply ==&lt;br /&gt;
&lt;br /&gt;
The following is a proposal that has not seen widespread discussion.&lt;br /&gt;
&lt;br /&gt;
The following is similar, but not identical, to CSS variables and CSS constants.&lt;br /&gt;
&lt;br /&gt;
An alternative to the XBL approach could be (for the lack of a better term) pseudo attributes. In &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://how2gainweightfast.org &amp;lt;span style=&amp;quot;color:black;font-weight:normal;text-decoration:none!important;background:none!important; text-decoration:none;&amp;quot;&amp;gt;weight gain&amp;lt;/span&amp;gt;]&amp;lt;/span&amp;gt; this approach, a style rule may set a number of arbitrary attribute-value pairs that in and of themselves have no effect. However, a style sheet in the shadow tree can use a new CSS attribute apply to select which values to apply.&lt;br /&gt;
&lt;br /&gt;
Example, using a prefix &#039;::&#039; for pseudo-attributes:&lt;br /&gt;
&lt;br /&gt;
    x-tabbar {&lt;br /&gt;
        background-color:                   azure;&lt;br /&gt;
        ::label-backround-color:            lightblue;&lt;br /&gt;
        ::selected-label-background-color:  slategray;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Within the component:&lt;br /&gt;
&lt;br /&gt;
    #ShadowRoot&lt;br /&gt;
        &amp;lt;style scoped&amp;gt;&lt;br /&gt;
            x-label {&lt;br /&gt;
                color: apply(background-color);                             [1.]&lt;br /&gt;
                background-color: apply(color);&lt;br /&gt;
                color: apply(::label-color);                                [2.]&lt;br /&gt;
                background-color: apply(::label-background-color)           [3.]&lt;br /&gt;
            }&lt;br /&gt;
            x-label[selected] {&lt;br /&gt;
                background-color: apply(::selected-label-background-color)  [4.]&lt;br /&gt;
                ::tab-background: apply(::selected-label-background-color)  [5.]&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/style&amp;gt;&lt;br /&gt;
        &amp;lt;div id=&amp;quot;background&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;x-label&amp;gt;Tasks&amp;lt;/x-label&amp;gt;&lt;br /&gt;
            &amp;lt;x-label selected&amp;gt;Calendar&amp;lt;/x-label&amp;gt;&lt;br /&gt;
            &amp;lt;x-label&amp;gt;Contacts&amp;lt;x-label&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# These 2 lines revert foreground (text) color and background color. This example shows how apply could apply not only to pseudo-attributes.&lt;br /&gt;
# The foreground-color of non-selected label is set to the ::label-color pseudo-attribute, if defined. As this comes after the initial setting of the label color in [1], it gets precedence. If, on the other hand, ::label-color is not defined (as is the case in above example), this line has no effect.&lt;br /&gt;
# Overriding the background color of labels by the same mechanism as in [2]. Unlike ::label-color, ::label-background-color is defined in the example though, so this line would take effect.&lt;br /&gt;
# Setting the background-color of the selected label.&lt;br /&gt;
# This line forwards the passed-in ::selected-label-background-color pseudo-attribute as ::tab-background, presumably for use in nested components of x-label.&lt;br /&gt;
&lt;br /&gt;
Advantages of this approach:&lt;br /&gt;
&lt;br /&gt;
* Avoids pseudo-element namespace pollution, while still allowing arbitrary names.&lt;br /&gt;
* A given pseudo-attribute can be applied in various places in a stright-forward manner.&lt;br /&gt;
* Pseudo-attributes can be applied directyl, or forwarded to nested components - the user does not need to know about the internal structure.&lt;br /&gt;
* Pseudo-attributes that are not applied have no effect, giving the author control over how the component is stylable.&lt;br /&gt;
* &#039;&#039;apply&#039;&#039; can be used for other effects, as shown in [1] in the example above.&lt;br /&gt;
&lt;br /&gt;
Downsides:&lt;br /&gt;
&lt;br /&gt;
* Requires extension to the CSS spec.&lt;br /&gt;
* General text &amp;amp; link-styling is unsatisfactory with this approach alone.&lt;br /&gt;
* This only handles styling of specific elements of the shadow DOM, but does not address how the component could style children of the host element that are attached to a content element, nor how inheritance into/out of the shadow DOM is to be handled.&lt;br /&gt;
&lt;br /&gt;
= Inheritance Across Boundaries =&lt;br /&gt;
&lt;br /&gt;
For several use cases (e.g., components creating native-like widgets) it may be beneficial to specify how CSS inheritance works across host-shadow boundaries.&lt;br /&gt;
&lt;br /&gt;
== The XBL way ==&lt;br /&gt;
&lt;br /&gt;
The following is AFAICT&lt;br /&gt;
&lt;br /&gt;
In XBL, CSS inheritance crossses the flattened tree. There is no way to limit or steer this behavior.&lt;br /&gt;
&lt;br /&gt;
== CSS extensions ==&lt;br /&gt;
&lt;br /&gt;
(WARNING: Inane scribblings!)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;::shadow&amp;lt;/code&amp;gt; sets the style to inherit for the shadow tree.&lt;br /&gt;
By default, this is equal to the effective style of the host element. &lt;br /&gt;
&lt;br /&gt;
    x-foo::shadow {&lt;br /&gt;
        background-color: grey;  // overrides the background color (only!) for the shadow DOM&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
On the shadow side, the ShadowRoot inherits from this styling by default, but can override what exactly to inherit as well (see below).&lt;br /&gt;
&lt;br /&gt;
=== Preventing automatic inheritance ===&lt;br /&gt;
&lt;br /&gt;
The including document can reset the individual style-attributes to &#039;initial&#039;, to prevent the component from &#039;snooping&#039; the outside styles.&lt;br /&gt;
Conversely, the component can just override the style-attributes to prevent the outside document from interfering with its beautiful designs.&lt;br /&gt;
&lt;br /&gt;
Now, having to reset every possible CSS attribute would be cumbersome, to say the least.&lt;br /&gt;
In order to make this useful, attribute group names could be introduced, that set the style for multiple attributes at once.&lt;br /&gt;
The only value a group can take is either:&lt;br /&gt;
&lt;br /&gt;
    &#039;initial&#039;: back to the initial value as determined by the UA&lt;br /&gt;
    &#039;inherit&#039;: inherit from DOM parent&lt;br /&gt;
&lt;br /&gt;
Also note that groups could be overlapping. E.g.,:&lt;br /&gt;
&lt;br /&gt;
    all: sets all attributes&lt;br /&gt;
    color-group: sets color, background-color, border-color&lt;br /&gt;
    border-group: border-...&lt;br /&gt;
    background-group: background-...&lt;br /&gt;
    images-group: background-image, border-image, list-style-image [e.g., prevent image loading]&lt;br /&gt;
    text-group: color, font-family, font-style, font-weight, letter-spacing, quotes, text-align, text-indend, text-transform, word-spacing, white-space, &lt;br /&gt;
    list-group: list-style-...&lt;br /&gt;
    table-group: empty-cells, caption-side,&lt;br /&gt;
    sound-group: azimuth, elevation, pitch, richness, speak-..., speech-rate, stress, voice-family, volume&lt;br /&gt;
    paged-group: orphans, widows&lt;br /&gt;
    visibility: not in a group (only contained in &#039;all&#039;)&lt;br /&gt;
    cursor: not in a group (only contained in &#039;all&#039;)&lt;br /&gt;
&lt;br /&gt;
E.g.,&lt;br /&gt;
&lt;br /&gt;
    x-foo::binding {&lt;br /&gt;
        images-group: initial;  // Don&#039;t allow &#039;...-image&#039; attributes to inherit into shadow DOM&lt;br /&gt;
        border-group: initial;  // Don&#039;t allow &#039;border-...&#039; attributes to inherit into shadow DOM&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
within the shadow DOM:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;style scoped&amp;gt;&lt;br /&gt;
        :scope {&lt;br /&gt;
            border-group: initial; // Don&#039;t allow &#039;border-...&#039; attributes to be inherited from outside document&lt;br /&gt;
            table-group: initial;  // Don&#039;t allow table-related attributes to be inherited from outside document&lt;br /&gt;
        }&lt;br /&gt;
    &amp;lt;/style&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;style scoped&amp;gt;&lt;br /&gt;
        :scope {&lt;br /&gt;
            all: initial;  // reset everything&lt;br /&gt;
            background-color: apply(background-color);  // ...except background-color (reapply the inherited value)&lt;br /&gt;
        }&lt;br /&gt;
    &amp;lt;/style&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other inherited attributes (e.g., text, list styles) would be inherited in this example.&lt;br /&gt;
Also note that the above groups with the described behavior could potentially be useful even outside the context of shadow DOM.&lt;br /&gt;
&lt;br /&gt;
A similar mechanism could be used to steer inheritance from the &amp;lt;content&amp;gt; element onto its selected children of the host element.&lt;br /&gt;
The selection here is whether to inherit from the host element, or from the style set on &amp;lt;content&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
However, the problem here is that there are more options:&lt;br /&gt;
&lt;br /&gt;
* initial as by the UA (+user sheets)&lt;br /&gt;
* original value as passed-in to the shadow DOM (only relevant to the shadow DOM side)&lt;br /&gt;
* inherited from the host element (only relevant to the ouside document&#039;s side)&lt;br /&gt;
* inherited from the &amp;lt;content&amp;gt; element&lt;br /&gt;
&lt;br /&gt;
To this end we might specify additional values besides &#039;initial&#039; and &#039;inherited&#039;:&lt;br /&gt;
&lt;br /&gt;
    &#039;original&#039;: back to the value set on the root node (equivalent to &#039;initial&#039; outside shadow DOMs, the value on ShadowRoot inside shadow DOMs)&lt;br /&gt;
    &#039;current&#039;: use the current render style - this is equivalent to &#039;inherit&#039; outside the &amp;quot;interference&amp;quot; of a shadow DOM&lt;br /&gt;
&lt;br /&gt;
On the shadow DOM side, &amp;quot;leaking&amp;quot; of styles can be prevented by re-setting attributes/attribute groups on the &amp;lt;content&amp;gt; element:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;style scoped&amp;gt;&lt;br /&gt;
        content {&lt;br /&gt;
            images-group: original; // reset &#039;...-image&#039; attributes to as they were set on the ShadowRoot&lt;br /&gt;
        }&lt;br /&gt;
        content[clean] {&lt;br /&gt;
            all: initial; // reset everything to pristine initial values for a &amp;lt;content&amp;gt; element that has the (user) attribute &#039;clean&#039;. &lt;br /&gt;
        }&lt;br /&gt;
    &amp;lt;/style&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the outside document&#039;s side we could introduce yet another pseudo-element ::inside that specifies the style to inherit from&lt;br /&gt;
(just reusing the name, since this pseude-element already has been proposed once):&lt;br /&gt;
&lt;br /&gt;
    x-foo::inside {&lt;br /&gt;
        all: inherit;              // reset all styles to inherit from the host element&lt;br /&gt;
        background-group: current; // ... except for &#039;background-...&#039; attributes, which are used with the current style (from &amp;lt;content&amp;gt;)&lt;br /&gt;
        white-space: initial;      // reset &#039;white-space&#039; to the default value (&#039;normal&#039; in the case of &#039;white-space&#039;)&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Note: can&#039;t use &#039;x-foo &amp;gt; *&#039; as selector here, because that would &amp;quot;miss&amp;quot; child text nodes!&lt;br /&gt;
&lt;br /&gt;
Another issue:&lt;br /&gt;
&lt;br /&gt;
* Doesn&#039;t handle the case where a &amp;lt;content&amp;gt; element selects multiple different elements and wants to style different elements differently.&lt;br /&gt;
&lt;br /&gt;
= Styling the host element =&lt;br /&gt;
&lt;br /&gt;
(see also the [http://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Rendering rendering discussion page])&lt;br /&gt;
&lt;br /&gt;
If the host element is rendered (this is the current default assumption.)&lt;br /&gt;
: If the component is confined (this is the currently thought-of scenario).&lt;br /&gt;
&lt;br /&gt;
:: This requires a second stylesheet in addition to any (scoped) stylesheet within the component.&lt;br /&gt;
&lt;br /&gt;
: If the component is &#039;&#039;not&#039;&#039; confined&lt;br /&gt;
&lt;br /&gt;
:: The component&#039;s stylesheet can style the host element directly, not requiring a second stylesheet&lt;br /&gt;
&lt;br /&gt;
:: The host element can be styled by stylesheets from 2 different scopes, requiring a resolution order. Most likely &#039;&#039;author&#039;&#039; &amp;gt; &#039;&#039;component&#039;&#039; &amp;gt; &#039;&#039;user&#039;&#039; &amp;gt; &#039;&#039;UA&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: The components stylesheet could be written so as to style descendants of the host element. Preventing this adds additional complexity.&lt;br /&gt;
&lt;br /&gt;
If the host element is NOT rendered&lt;br /&gt;
This raises the question how styles that address the host element are to be handled. Most likely by storing the style on the host element, but applying it to the shadow tree instead, causing additional complexity&lt;br /&gt;
&lt;br /&gt;
: If the ShadowRoot is rendered (if it is an element instead of a separate node type)&lt;br /&gt;
&lt;br /&gt;
:: ...&lt;br /&gt;
&lt;br /&gt;
: If the ShadowRoot is not rendered&lt;br /&gt;
&lt;br /&gt;
:: ...&lt;br /&gt;
&lt;br /&gt;
= Styling &amp;lt;code&amp;gt;&amp;lt;content&amp;gt;&amp;lt;/code&amp;gt; elements =&lt;br /&gt;
&lt;br /&gt;
This has similar issues and raises similar questions as styling the host element.&lt;br /&gt;
&lt;br /&gt;
In addition, a content element may select multiple different child elements from under the host element. E.g., &amp;lt;content select=&amp;quot;A B .left&amp;quot;&amp;gt;, or a simple &amp;lt;content&amp;gt; that takes whatever isn&#039;t taken by other contents. In this case it&#039;s conceivable that different elements should be styled different. I.e., a single style assigned to &amp;lt;content&amp;gt; is not sufficient.&lt;br /&gt;
XBL2&#039;s &amp;lt;code&amp;gt;apply-binding-sheets&amp;lt;/code&amp;gt; allows to do this, but:&lt;br /&gt;
&lt;br /&gt;
* it can style any descendant, not just direct children&lt;br /&gt;
* it breaks confinement&lt;br /&gt;
&lt;br /&gt;
Approaches to solve this:&lt;br /&gt;
&lt;br /&gt;
* Allow the component to not just style the host, but also the host&#039;s direct children - i.e. don&#039;t see the problem as styling render children of &amp;lt;content&amp;gt;, but as styling HTML children of the host&lt;br /&gt;
* Require wrapper components that do styling only, reducing the problem to styling the host element&lt;br /&gt;
&lt;br /&gt;
Example for the 2nd suggestion: Rather than having&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;x-foo&amp;gt; ----------&amp;gt; [ShadowRoot]&lt;br /&gt;
    &amp;lt;A&amp;gt;                  &amp;lt;content&amp;gt; (A&#039;s in red, B&#039;s in green)&lt;br /&gt;
    &amp;lt;B&amp;gt;&lt;br /&gt;
  &amp;lt;/x-foo&amp;gt;&lt;br /&gt;
&lt;br /&gt;
require&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;x-foo&amp;gt; ----------------------------------&amp;gt; [ShadowRoot]&lt;br /&gt;
    &amp;lt;x-A&amp;gt; --------&amp;gt; [ShadowRoot] (red)           &amp;lt;content&amp;gt; &lt;br /&gt;
      &amp;lt;A&amp;gt;              &amp;lt;content&amp;gt;&lt;br /&gt;
    &amp;lt;x-B&amp;gt; --------&amp;gt; [ShadowRoot] (green)&lt;br /&gt;
      &amp;lt;B&amp;gt;              &amp;lt;content&amp;gt;&lt;br /&gt;
  &amp;lt;/x-foo&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(not very elegant, though...)&lt;/div&gt;</summary>
		<author><name>FrShorts7</name></author>
	</entry>
</feed>