amplesdk icon indicating copy to clipboard operation
amplesdk copied to clipboard

XUL: style attribute ignored by most elements.

Open h6w opened this issue 14 years ago • 1 comments

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 in a positive way.

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.

h6w avatar Oct 15 '11 17:10 h6w

ilinsky, I know we've discussed this, so I've created an issue so that I can create a branch to reference it. I'll go through the implementation now.

h6w avatar Oct 15 '11 17:10 h6w