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.
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).
1) 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.
2) 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