Index: branches/wmf/1.18wmf1/tests/qunit/index.html |
— | — | @@ -43,6 +43,7 @@ |
44 | 44 | <script src="../../resources/jquery/jquery.byteLength.js"></script> |
45 | 45 | <script src="../../resources/jquery/jquery.byteLimit.js"></script> |
46 | 46 | <script src="../../resources/jquery/jquery.colorUtil.js"></script> |
| 47 | + <script src="../../resources/jquery/jquery.delayedBind.js"></script> |
47 | 48 | <script src="../../resources/jquery/jquery.getAttrs.js"></script> |
48 | 49 | <script src="../../resources/jquery/jquery.localize.js"></script> |
49 | 50 | <script src="../../resources/jquery/jquery.tabIndex.js"></script> |
— | — | @@ -69,6 +70,7 @@ |
70 | 71 | <script src="suites/resources/jquery/jquery.byteLength.js"></script> |
71 | 72 | <script src="suites/resources/jquery/jquery.byteLimit.js"></script> |
72 | 73 | <script src="suites/resources/jquery/jquery.colorUtil.js"></script> |
| 74 | + <script src="suites/resources/jquery/jquery.delayedBind.test.js"></script> |
73 | 75 | <script src="suites/resources/jquery/jquery.getAttrs.js"></script> |
74 | 76 | <script src="suites/resources/jquery/jquery.localize.js"></script> |
75 | 77 | <script src="suites/resources/jquery/jquery.tabIndex.js"></script> |
Property changes on: branches/wmf/1.18wmf1/tests/qunit/index.html |
___________________________________________________________________ |
Modified: svn:mergeinfo |
76 | 78 | Merged /branches/REL1_18/phase3/tests/qunit/index.html:r107913,107924 |
Index: branches/wmf/1.18wmf1/tests/qunit/suites/resources/jquery/jquery.delayedBind.test.js |
— | — | @@ -0,0 +1,41 @@ |
| 2 | +test('jquery.delayedBind with data option', function() { |
| 3 | + var $fixture = $('<div>').appendTo('body'), |
| 4 | + data = { magic: "beeswax" }, |
| 5 | + delay = 50; |
| 6 | + |
| 7 | + $fixture.delayedBind(delay, 'testevent', data, function(event) { |
| 8 | + start(); // continue! |
| 9 | + ok(true, 'testevent fired'); |
| 10 | + ok(event.data === data, 'data is passed through delayedBind'); |
| 11 | + }); |
| 12 | + |
| 13 | + expect(2); |
| 14 | + stop(); // async! |
| 15 | + |
| 16 | + // We'll trigger it thrice, but it should only happen once. |
| 17 | + $fixture.trigger('testevent', {}); |
| 18 | + $fixture.trigger('testevent', {}); |
| 19 | + $fixture.trigger('testevent', {}); |
| 20 | + $fixture.trigger('testevent', {}); |
| 21 | +}); |
| 22 | + |
| 23 | +test('jquery.delayedBind without data option', function() { |
| 24 | + var $fixture = $('<div>').appendTo('body'), |
| 25 | + data = { magic: "beeswax" }, |
| 26 | + delay = 50; |
| 27 | + |
| 28 | + $fixture.delayedBind(delay, 'testevent', function(event) { |
| 29 | + start(); // continue! |
| 30 | + ok(true, 'testevent fired'); |
| 31 | + }); |
| 32 | + |
| 33 | + expect(1); |
| 34 | + stop(); // async! |
| 35 | + |
| 36 | + // We'll trigger it thrice, but it should only happen once. |
| 37 | + $fixture.trigger('testevent', {}); |
| 38 | + $fixture.trigger('testevent', {}); |
| 39 | + $fixture.trigger('testevent', {}); |
| 40 | + $fixture.trigger('testevent', {}); |
| 41 | +}); |
| 42 | + |
Property changes on: branches/wmf/1.18wmf1/tests/qunit/suites/resources/jquery/jquery.delayedBind.test.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 43 | + native |
Index: branches/wmf/1.18wmf1/resources/jquery/jquery.collapsibleTabs.js |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | // if we haven't already bound our resize hanlder, bind it now |
26 | 26 | if( !$.collapsibleTabs.boundEvent ) { |
27 | 27 | $( window ) |
28 | | - .delayedBind( '500', 'resize', null, function( ) { $.collapsibleTabs.handleResize(); } ); |
| 28 | + .delayedBind( '500', 'resize', function( ) { $.collapsibleTabs.handleResize(); } ); |
29 | 29 | } |
30 | 30 | // call our resize handler to setup the page |
31 | 31 | $.collapsibleTabs.handleResize(); |
Index: branches/wmf/1.18wmf1/resources/jquery/jquery.delayedBind.js |
— | — | @@ -19,6 +19,11 @@ |
20 | 20 | * @param callback Function to call |
21 | 21 | */ |
22 | 22 | delayedBind: function( timeout, event, data, callback ) { |
| 23 | + if ( arguments.length == 3 ) { |
| 24 | + // Shift optional parameter down |
| 25 | + callback = data; |
| 26 | + data = undefined; |
| 27 | + } |
23 | 28 | var encEvent = encodeEvent( event ); |
24 | 29 | return this.each( function() { |
25 | 30 | var that = this; |
Index: branches/wmf/1.18wmf1/resources/mediawiki/mediawiki.util.js |
— | — | @@ -164,12 +164,13 @@ |
165 | 165 | var s = document.createElement( 'style' ); |
166 | 166 | s.type = 'text/css'; |
167 | 167 | s.rel = 'stylesheet'; |
| 168 | + // Insert into document before setting cssText (bug 33305) |
| 169 | + document.getElementsByTagName('head')[0].appendChild( s ); |
168 | 170 | if ( s.styleSheet ) { |
169 | 171 | s.styleSheet.cssText = text; // IE |
170 | 172 | } else { |
171 | 173 | s.appendChild( document.createTextNode( text + '' ) ); // Safari sometimes borks on null |
172 | 174 | } |
173 | | - document.getElementsByTagName('head')[0].appendChild( s ); |
174 | 175 | return s.sheet || s; |
175 | 176 | }, |
176 | 177 | |
Property changes on: branches/wmf/1.18wmf1/resources/mediawiki/mediawiki.util.js |
___________________________________________________________________ |
Modified: svn:mergeinfo |
177 | 178 | Merged /branches/REL1_18/phase3/resources/mediawiki/mediawiki.util.js:r107924 |
178 | 179 | Merged /trunk/phase3/resources/mediawiki/mediawiki.util.js:r106992 |
Property changes on: branches/wmf/1.18wmf1 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
179 | 180 | Merged /branches/REL1_18/phase3:r107913,107924 |
180 | 181 | Merged /trunk/phase3:r105007,106992 |