On 6/11/13, Jon Robson <jdlrobson(a)gmail.com> wrote:
Many of you on the mailing list should be aware of the
troubles that
the style attribute brings to mobile [1,2] and the amount of hacks [3]
that we have to introduce to work around them.
I still truly believe the only way we can resolve this is a long term
rethink of how we approach custom styling on wiki. I have also heard
from Chris Steipp that there are security implications with allowing
inline styles which such a move would address.
I have submitted a patch [4] (mostly to share ideas and prompt
discussion - before you pounce on it be aware I have -2ed it to allow
discussion on whether there is a better way to do this - for instance
it might be worthy of a new namespace, it might need more protection
etc.. ).
All the patch does is allow Template:Foo to have an associated
stylesheet Template:Foo.css which is included in pages that use it.
So if the San Francisco article uses templates Foo, Bar and Baz, a
style tag will be constructed from the content of Template:Foo.css,
Template:Bar.css and Template:Bar.css and inserted into the page. When
the templates change the entire page San Francisco is changed and thus
the new styling is applied.
This would reduce the need for css hacks in mobile and keep power in
editors hands.
On the assumption that this patch makes it into core in some form that
in future the mobile site can strip any style attributes from content
and use the template css files instead and thus benefit from the
ability to use media queries. This could be a long tedious process but
I think it needs to be done.
Thanks in advance for your discussion and thoughts around this long
standing issue!
~Jon
[1]
https://www.mediawiki.org/wiki/Requests_for_comment/Deprecating_inline_styl…
[2]
https://bugzilla.wikimedia.org/show_bug.cgi?id=35704
[3]
https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/maste…
[4]
https://gerrit.wikimedia.org/r/68123
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I like the idea of this (for reasons that have nothing to do with
mobile). It would be nice to have css associated with the content
defined. I'm pretty sure wikis want things like this. Wikinews for
example loads MediaWiki:Common.css/{{FULLPAGENAME}} basically on every
page.
To be honest though, I'm unclear how this would fix things for mobile.
Wouldn't folks just put their problematic inline styles into a
stylesheet, and have them be just as problematic in the stylesheet?
(Not overly following mobile development)
I still truly believe the only way we can resolve this
is a long term
rethink of how we approach custom styling on wiki. I have also heard
from Chris Steipp that there are security implications with allowing
inline styles which such a move would address.
I'm curious what those might be (Although I expect I won't find
out...). I know your patch is a proof of concept, but in its current
form, it introduces various security issues that don't exist before
(arbitrary css allowed = XSS).
---
Now, to bikeshed (I assume you're expecting this, sending it to
wikitech-l and all).
Personally, I would like the template namespace to not be special.
Hence I would like this all to work for other namespaces. So if you
create a fake template in your user space, you could do the css thing
too. This suggests a "CSS" namespace where you can create pages like
CSS:Template:Foo.
Alternatively we could have a css parser function where you put
<css>foo {border: red }....</css>, and it gets applied to the current
page, and everything that is transcluding it (Possibly with an option
similar to <noinclude> where the syntax highlighted version of the
tags contents is only shown on the original page and not on
transcluded pages.). The downside is less clear a content/style
separation, but its still quite a clear separation imo.
--bawolff