On Thu, 10 May 2012 11:52:17 -0700, MZMcBride z@mzmcbride.com wrote:
Jon Robson wrote:
Sorry for the lack of continued discussion on this thread. I've been thinking lots and lots about this over the last weeks and would like to suggest a course of action.
I think we are agreed that the majority of inline styles come from templates and it is the templates we need to fix up.
I missed this thread in April, but no, I don't think there's agreement that it's the templates that need to be fixed. Maybe a few them need adjustments, but inline styling is unfairly being portrayed as a demon in this thread. I'd estimate that inline styling is present on over 99% of pages on the English Wikipedia, so any solution that involves removing inline styling is simply insane and a non-starter.
Saying that inline styles are present on over 99% pages on en.wp is a logical fallacy. 99% of articles may have inline styles in their output but the only pages that are an actual issue are ones where the inline styles are in the content themselves not in embedded templates. If we have 1000 pages with 1 template and inline styles inside the template, then we only have to fix the one template. NOT the 1000 pages.
Don't underestimate template changes or bots.
While you can put some styling into global pages, sometimes you need one particular element to be a different color or a different font weight or whatever. This flexibility can't be tossed out because it's inconvenient. As Brion noted, there's often _data_ stored in this styling (for example, a row can be highlighted in yellow and surrounding page text might reference this highlighting).
- We turn on inline style scrubbing in the beta of the __mobile
site__ (for those that don't know this is an opt in service [1] and won't effect anyone who has no opted in). We invite community members to join the beta and help us survey and fix the damage. Since the inline style scrubbing only applies to the beta - it's business as usual elsewhere. The desktop site is not effected in any way.
Have you found a page (any page) that doesn't use any inline styling? It sounds like you're suggesting breaking every page on the mobile site. It's trivial to strip all inline styling, but I can't imagine that will improve the mobile experience for anyone.
Selection of pages from Special:Random: - https://en.wikipedia.org/wiki/Vic_Belsham - No explicit inline styles - https://en.wikipedia.org/wiki/Cecil_Hunt - No explicit inline styles - https://en.wikipedia.org/wiki/Hazeliidae - No explicit inline styles - https://en.wikipedia.org/wiki/Maid_of_Iowa - No explicit inline styles - https://en.wikipedia.org/wiki/James_Herries_Beattie - No explicit inline styles - https://en.wikipedia.org/wiki/Jack_McCafferty - No explicit inline styles - https://en.wikipedia.org/wiki/Adams-Pickering_Block - No explicit inline styles - https://en.wikipedia.org/wiki/Live_at_the_Fillmore_%28The_Residents_album%29 - No explicit inline styles - https://en.wikipedia.org/wiki/Compact_Muon_Solenoid - One html4 border="1" - https://en.wikipedia.org/wiki/List_of_Indiana_state_historical_markers_in_Ti... - width: 98%;
- We **allow** any inline styles that are annotated. I know
ResourceLoader uses a @noflip annotation to prevent flipping of css rules for right to left text. Using the same idea we introduce the @mobilesafe annotation. When at the beginning of an inline style this annotation signals to the MobileFrontend extension NOT to scrub the inline style. For example, in the following html only foo2 would be scrubbed
<div id='foo1' style="/*@mobilesafe*/padding:10px;"></div> <div id='foo2' style="padding:10px;"></div> results in the html: <div id='foo1' style="/*@mobilesafe*/padding:10px;"></div> <div id='foo2'></div> This is **key** as it allows template admins to do one of two things - move the inline styles into MediaWiki:Common.css (which allows us to easily fix them for mobile much easier and without !important rules) or prefix inline styles with @mobilesafe after they have verified they are purely presentational (and work on mobile).
I understand the intention here, but this seems pretty nasty. While I generally favor being explicit over being implicit, this is one case where it'd be nice if the rendering "just works" without requiring human intervention for every page. If anything, you could do the opposite: have a "stripformobile" keyword that removes problematic styling in certain specific cases, but that needs further consideration.
I'm still having difficulty understanding your overall problem. "margin: -1px 21em 0 0;" is pretty stupid code, regardless of device. Specific problems like this are easy enough to address. Is there any reason for the proposed additional complexity? Stripping all inline styling is "cut off your arm because your nails need to be cut" thinking.
MZMcBride