resourceloader: Simplify CSS loading by removing IE8 hacks
authorOri Livneh <ori@wikimedia.org>
Sat, 18 Jun 2016 22:48:45 +0000 (15:48 -0700)
committerOri Livneh <ori@wikimedia.org>
Wed, 22 Jun 2016 16:05:19 +0000 (09:05 -0700)
commit0a70f66c22333fc117f0fa52a4410b4921922876
treef95f6a4758841c7399e554f7d5ba4e65a4675256
parent7e2382d797c0d4ea8e66cbd53b7889103d6bb895
resourceloader: Simplify CSS loading by removing IE8 hacks

* Remove 'isIEto9'. Since we blacklist anything before 9, isIE9 is enough.

* Set the content of style tags and the href attribute of link tags before
  inserting them into the DOM. Previously, we did DOM insertion first, due
  to T35305. I verified that IE9 is not affected.

* Use document.head instead of document.getElementsByTagName( 'head' )[ 0 ].

* Set / extend the contents of link tags via
  node.appendChild( document.createTextNode( ... ) ) this works in IE9, and
  adding CSS in this way does not strip @media queries in the way that
  repeat node.styleSheet.cssText += '...' operations will. This means the
  workarounds put in place to mitigate T108727 can be removed.
  quirksmode confirms that document.createTextNode() is supported in IE9,
  and mentions the issue with style tags as IE8-specific:
  http://quirksmode.org/dom/core/#t01

I created a test page with all the behaviors here:
https://people.wikimedia.org/~ori/If51f8303b/index.html

It loads correctly in IE9:
https://people.wikimedia.org/~ori/If51f8303b/screenshot.png

Change-Id: If51f8303b74fdc8001cfa20ea8b016fdc210b1b1
resources/src/mediawiki/mediawiki.js