clientside/amplesdk — Issue #99: XUL: style attribute ignored by most elements.
Author: h6w
Created: 2011-10-15 17:22:38+00:00
State: open

I am arguing that the style attribute should be passed through by all XUL elements in amplesdk.

The style attribute should not be used for most development as keeping style and content separate is a hallmark of good software. This also applies to XUL. e.g.
https://developer.mozilla.org/en/Writing_Skinnable_XUL_and_CSS
in which David Hyatt says in 2000

4. style="..." is prohibited in XUL files without approval Any usages of inline style are extremely dangerous, since they are overriding the included skin, and must be approved before their usage will be allowed.

However, sometimes its necessary to use the style tag to get around various bad design decisions with XUL in particular, e.g.
https://developer.mozilla.org/en/XUL/Things_I've_tried_to_do_with_XUL

XUL Gear (https://addons.mozilla.org/en-US/firefox/addon/xul-gear/) implements style as a discriminate tab, enticing the developer to make good use of it.

A quick search for "xul style attribute" on MDN, brings up hundreds of pages referencing the attribute.

Finally, the style attribute is actually listed as an attribute for all elements at https://developer.mozilla.org/en/XUL/Attribute/style with the note "It is preferred to put style rules in style sheets."

I see David Hyatt's prohibition more as a warning than as a guide for implementation. The style attribute is useful when you're working out how the UI should look. I frequently use style tags while designing the UI, and then shift them into CSS later. Additionally, the style tag is easier to preprocess than to preprocess ample+css due to the environment being known at runtime.

As such, I feel that any contents of style attribute should be passed through to the html DOM verbatim.