Last modified: 2014-08-29 01:54:26 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T63008, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 61008 - ResourceLoader should make it possible to automatically expand #fff-style colours to #ffffff-style
ResourceLoader should make it possible to automatically expand #fff-style col...
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.23.0
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 61010
  Show dependency treegraph
 
Reported: 2014-02-07 05:35 UTC by Isarra
Modified: 2014-08-29 01:54 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
IE gradient that was given a #fff and exploded (25.27 KB, image/png)
2014-02-07 05:35 UTC, Isarra
Details
IE gradient that was given an #ffffff (24.68 KB, image/png)
2014-02-07 05:38 UTC, Isarra
Details

Description Isarra 2014-02-07 05:35:32 UTC
Created attachment 14517 [details]
IE gradient that was given a #fff and exploded

The shorthand makes IE explode sometimes, but it's a lot easier to use when writing/changing css. RL should automatically convert it in order to avoid explosions.
Comment 1 Isarra 2014-02-07 05:38:20 UTC
Created attachment 14518 [details]
IE gradient that was given an #ffffff

You may notice the top border is missing and the gradient doesn't line up properly with the tabs, but these are general IE and/or Vector problems. At least with the full colour the gradient didn't explode.
Comment 2 Bartosz Dziewoński 2014-02-07 12:39:28 UTC
In general it probably shouldn't, or even should convert them the other way to make the code shorter… this only applies to old IE filters, as I understand.
Comment 3 Isarra 2014-02-07 18:29:49 UTC
After the css is gzipped the relative size should be the same. But the code itself would indeed be shorter because then there would be less reason for writers to use longhand...

I agree it's a very minor thing, but we do try to support IE and this would simplify that, especially for modern skins.
Comment 4 Isarra 2014-02-09 04:50:21 UTC
(In reply to comment #2)
> In general it probably shouldn't, or even should convert them the other way
> to make the code shorter… this only applies to old IE filters, as I understand.

It's not just filters. I just had IE7 get tripped up by a background-colour: #fff. #ffffff worked fine.
Comment 5 Bartosz Dziewoński 2014-02-09 11:50:02 UTC
It would seem that it's possible to "normalize" color definitions with LESS functions: you can use something like `rgb(red(@c), green(@c), blue(@c))` (assuming the color is in the @c variable) to convert it to the canonical #rrggbb form. There's a bunch of related functions too, see http://lesscss.org/functions/#color-functions for details. (I've heard that the PHP version we're using is missing some, but the ones I tested worked.)
Comment 6 Isarra 2014-02-09 17:19:39 UTC
A major issue with LESS right now seems to be that there are many things that can be done with either LESS or RL directly. This leads to messiness and inconsistency, because there don't seem to be any standards as to which is better for what, despite each being better for some things than the other.

I say this because while you can, using LESS functions for this would get very messy very quickly, and at that point it'd be far more practical to just write out the number. But this is something where RL could handle everything in the background, and neatly, without the user having to do anything special. It just happens and everything works.

That's what we want - less to have to think about, not more.
Comment 7 Bartosz Dziewoński 2014-02-13 19:40:52 UTC
(In reply to Isarra from comment #6)
> A major issue with LESS right now seems to be that there are many things
> that can be done with either LESS or RL directly.

Such as? The only thing like this I'm aware of is that you can @import other stylesheets in LESS instead of putting them in the 'styles' array of a ResourceLoader module.


> I say this because while you can, using LESS functions for this would get
> very messy very quickly, and at that point it'd be far more practical to
> just write out the number. But this is something where RL could handle
> everything in the background, and neatly, without the user having to do
> anything special. It just happens and everything works.

If you create a mixin for this, then I don't really think that having to write `normalize-color(@color)` instead of `@color` is that much of a trouble, especially since there are very few cases where the color specification has to be provided in a specific format (just IE filters, no?).

But yes, if you're not using variables or otherwise generate the color values dynbamically, it probably will be more practical to just write `#ffffff` instead of `normalize-color(#fff)`.
Comment 8 Isarra 2014-02-13 22:53:28 UTC
(In reply to Bartosz Dziewoński from comment #7)
> (In reply to Isarra from comment #6)
> > A major issue with LESS right now seems to be that there are many things
> > that can be done with either LESS or RL directly.
> 
> Such as? The only thing like this I'm aware of is that you can @import other
> stylesheets in LESS instead of putting them in the 'styles' array of a
> ResourceLoader module.

Such as converting colours to six digits automatically without the developer having to worry about using some special mixin, and having to keep worrying about it. Indefinitely.

> > I say this because while you can, using LESS functions for this would get
> > very messy very quickly, and at that point it'd be far more practical to
> > just write out the number. But this is something where RL could handle
> > everything in the background, and neatly, without the user having to do
> > anything special. It just happens and everything works.
> 
> If you create a mixin for this, then I don't really think that having to
> write `normalize-color(@color)` instead of `@color` is that much of a
> trouble, especially since there are very few cases where the color
> specification has to be provided in a specific format (just IE filters, no?).

No. As I said, it appears it can apply to other things, including regular background colours.

> But yes, if you're not using variables or otherwise generate the color
> values dynbamically, it probably will be more practical to just write
> `#ffffff` instead of `normalize-color(#fff)`.

The whole point of this bug is that we shouldn't have to worry about when to use #fff or #ffffff in the first place. Because as a rule, nobody ever does - we write whatever, we check how it works cross-browser, and then if something goes wrong, we track it down and fix it. This bug is to make it so that slightly less can go wrong. That's all.

By using RL as opposed to a mixin, we can ensure that it is all resolved such that nobody will ever have to worry this particular issue again.
Comment 9 Erwin Dokter 2014-02-20 18:59:32 UTC
If this bug is solely for the purpose of preventing the MS filter from blowing up, there are two thing that needs to be done:

* expand CSS shorthands (#fff > #ffffff)
* make it work with 'transparent' (must be converted to #00000000)

I don't know if LESS has such capabilities, would be great if it does.
Comment 10 Isarra 2014-02-20 19:01:07 UTC
As I have already stated twice, this is not just for the filter.
Comment 11 Erwin Dokter 2014-02-20 19:17:48 UTC
Regardless, that is what needs to be done for the filter to work.
Comment 12 Isarra 2014-02-20 20:51:05 UTC
The filter already works. It may not work well, but that's doesn't mean it doesn't work at all.
Comment 13 Krinkle 2014-02-20 20:56:10 UTC
I don't think it is within the scope of ResourceLoader (a framework to package and  deliver modules) to correct bad input.

If you want to use LESS to abstract browser bugs, that's fine. But ResourceLoader itself should play no part in changing the styles or scripts to address browser bugs.

If CSSMin is optimising things (e.g. #ffffff, #FFF, white -> #fff) and that causing problems in IE, then it is within the scope of RL to not do that as it shouldn't introduce bugs, but certainly shouldn't (intentionally) fix them.
Comment 14 Krinkle 2014-02-20 20:56:35 UTC
Bug as reported should imho be wontfix, but feel free to repurpose if desired. Or open a new one for that.
Comment 15 Krinkle 2014-08-29 01:54:26 UTC
(In reply to Krinkle from comment #13)
> I don't think it is within the scope of ResourceLoader (a framework to
> package and  deliver modules) to correct bad input.
> 
> If you want to use LESS to abstract browser bugs, that's fine. But
> ResourceLoader itself should play no part in changing the styles or scripts
> to address browser bugs.
> 
> If CSSMin is optimising things (e.g. #ffffff, #FFF, white -> #fff) and that
> causing problems in IE, then it is within the scope of RL to not do that as
> it shouldn't introduce bugs, but certainly shouldn't (intentionally) fix
> them.

If you wrote CSS that uses #fff in an IE-specific css property that requires #fffff, then don't write that CSS.

If it's produced by a Less function, fix that.

If it's written as #ffffff but optimised back to #fff by something (e.g. CSSMin) file a bug for that.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links