Topic on Talk:Requests for comment/ResourceLoader CSS Extensions

(talkcontribs)

Nice ideas! I'd really like to have automatic vendor-prefixing and linking on-wiki files.

How could we make them available for inline style attributes? That would mean to split the functionality in a parser and a translator part. The translator then could be used from sanitizeHTML() and co.

Some things to point out at #Syntax:

  • @-mw-extendedcss should be standard mode. Only if you have something that need not use it you might declare a @-mw-dontextendcss block.
  • -mw-embed: I don't like it to be a function with url()s as the argument. How about -mw-embed-url('background.gif') and -mw-embed-file('Name.png', 100)? Another possibilty would be to allow the embed-comment directly before the css value, instead of before the css property: background-image: -mw-file('Background.jpg'), /* @embed */ url(images/icon.gif);
  • calc(): I can't see any need for that. Do you want to allow the whole #expr:-syntax, or define you own math subset? The example with the 500px thing shows a need for a kind of templating system, but not for a calc-function.
Dantman (talkcontribs)

@-mw-extendedcss is ONLY for things that don't fit in with standard css. Things like -mw-file will work unconditionally because they don't conflict. However things like converting border-radius: ...; to {-moz-,-webkit-,}border-radius: ...; have a slight risk of conflicting with existing css that already specifies all the vendor prefixes. In those cases we don't want extended css on because we could go and break a previously working stylesheet.

I don't like the idea of -mw-embed-url and -mw-embed-file. That's essentially defining a -mw-embed-* pattern that requires us to create a new function for each and every non-embed function we add. I picked -mw-embed( ... ); because it will work with everything. Native url(); We add in -mw-file, that'll work. Throw in a -mw-thumb, that'll work too. Say in the future we create a icon framework extension that lets action tabs have icons defined by the wiki and lets skins include the icons using -mw-icon( 'watch', 16 ); then we'd have to go back and also implement -mw-embed-icon.

calc() is defined by css3-values, I'm not making up syntax here. The idea is to allow the portion of static calculations we can pre-process to be used. ie: We'll substitute calc( 500px + 15px ); but not calc( 100% + 5em ); because it's not possible to preprocess two different units together. yes my example could use a variable system, however that does not exclude calc(). Because if you do add a variable system you will absolutely need calc() at that point. Because authors are inevitably going to need something like "$theboxwidth - 1px". Nearly every case where you would want to repeat numbers several times will be in a case where the numbers are not all the same.

Reply to "Points from Bergi"