Page MenuHomePhabricator

Make mw.util.addCSS resistant to IE's @font-face bug with setting cssText before DOM insertion
Closed, ResolvedPublic

Description

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:

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


Version: 1.17.x
Severity: normal

Details

Reference
bz33305
TitleReferenceAuthorSource BranchDest Branch
[maintain-harbor] validate config with pydanticrepos/cloud/toolforge/maintain-harbor!24raymond-ndibeconfig_validationmain
[maintain-harbor] use clickrepos/cloud/toolforge/maintain-harbor!23raymond-ndibeuse_clickmain
d/changelog: bump to 0.0.13repos/cloud/toolforge/builds-cli!56raymond-ndibebump_versionmain
[builds-cli] add shellcheckrepos/cloud/toolforge/builds-cli!51raymond-ndibeadd_shellcheckmain
[toolforge-deploy] add shellcheckrepos/cloud/toolforge/toolforge-deploy!175raymond-ndibeadd_shellcheckmain
[envvars-cli] add shellcheckrepos/cloud/toolforge/envvars-cli!22raymond-ndibeadd_shellcheckmain
Customize query in GitLab

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:04 AM
bzimport set Reference to bz33305.

Fixed in r106992. Waiting for confirmation from IE7/IE8 users.

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