r68800 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68799‎ | r68800 | r68801 >
Date:22:40, 30 June 2010
Author:tparscal
Status:ok
Tags:
Comment:
Now using jQuery (as we always should have been) for appending styles. Also fixed bug where registered modules which have dependencies would queue the dependencies but not the base module.
Modified paths:
  • /branches/resourceloader/phase3/resources/core/mw.js (modified) (history)
  • /branches/resourceloader/phase3/resources/test/bar.css (added) (history)

Diff [purge]

Index: branches/resourceloader/phase3/resources/test/bar.css
@@ -0,0 +1,5 @@
 2+@CHARSET "UTF-8";
 3+
 4+body {
 5+ background-color: #00AADD;
 6+}
\ No newline at end of file
Property changes on: branches/resourceloader/phase3/resources/test/bar.css
___________________________________________________________________
Name: svn:eol-style
17 + native
Index: branches/resourceloader/phase3/resources/core/mw.js
@@ -428,10 +428,8 @@
429429 function execute( requirement ) {
430430 if ( registry[requirement].state === 'loaded' ) {
431431 // Add style, if any
432 - if ( typeof registry[requirement].style === 'string' ) {
433 - var style = document.createElement( 'style' );
434 - style.type = 'text/css';
435 - style.innerHTML = registry[requirement].style;
 432+ if ( typeof registry[requirement].style === 'string' && registry[requirement].style.length ) {
 433+ $( 'head' ).append( '<style type="text/css">' + registry[requirement].style + '</style>' );
436434 }
437435 // Add localizations
438436 if ( typeof registry[requirement].localization === 'object' ) {
@@ -571,7 +569,8 @@
572570 // Execute right away
573571 execute( name );
574572 } else {
575 - // Queue it up and work the queue
 573+ // Queue it up (including the base module!) and work the queue
 574+ requirements[requirements.length] = name;
576575 queue[queue.length] = { 'pending': requirements, 'callback': function() { execute( name ); } };
577576 that.work();
578577 }

Status & tagging log