Last modified: 2012-01-02 15:40:10 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 T35305, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 33305 - Make mw.util.addCSS resistant to IE's @font-face bug with setting cssText before DOM insertion
Make mw.util.addCSS resistant to IE's @font-face bug with setting cssText bef...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.17.x
All All
: Normal normal (vote)
: 1.19.0 release
Assigned To: Krinkle
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-21 21:59 UTC by Krinkle
Modified: 2012-01-02 15:40 UTC (History)
3 users (show)

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


Attachments

Description Krinkle 2011-12-21 21:59:40 UTC
Although it's common to set properties on newly created elements off-DOM and insert them when ready, in Internet Explorer @font-face rules set through cssText don't work unless the <style> tag is in the DOM when the cssText is set.

Stupid ? Yes, very. But it's just the way it is.

See also:
* http://stackoverflow.com/questions/7931658/dynamically-adding-font-face-rule-in-ie-8-and-less/7952904#7952904
* https://www.mediawiki.org/wiki/Special:Code/MediaWiki/106706#c28088

We should simply change mw.util.addCSS to insert first and set cssText after. Might decrease performance a little bit (since it'd be changing the dom twice then), but we are discouraging use of addCSS anyway since people are encourages to maintain actual stylesheets instead (which are loaded by ResourceLoader in the same request at no signifiant additional cost).

The few uses of addCSS for dynamic style insertion will do fine.

Current code:
https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/resources/mediawiki/mediawiki.util.js?revision=96151&view=markup#l146
Comment 1 Krinkle 2011-12-21 22:11:00 UTC
Fixed in r106992. Waiting for confirmation from IE7/IE8 users.

After confirmation, we should backport this as far as possible.

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


Navigation
Links