https://bugzilla.wikimedia.org/show_bug.cgi?id=33711
Krinkle <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC|[email protected] | Resolution| |INVALID Summary|mw.util.$content is null |mw.util.$content shouldn't | |be null inside | |mw.loader.using('mediawiki. | |util', ..) --- Comment #2 from Krinkle <[email protected]> 2012-01-14 03:31:10 UTC --- (In reply to comment #0) > From: http://labs.wikimedia.deployment.wmflabs.org/w/index.php?diff=237 > > This is about http://commons.wikimedia.deployment.wmflabs.org > > 1. mw.util is undefined when attempting to access from MediaWiki:Common.js > without using mw.loader.load I could reproduce this, but INVALID bug. This is correct and expected behavior and has been since 1.17. Only difference is that due to the loader being improving and loading faster, race conditions are more likely to ocurr, thus requiring that dependencies are always declared. This is best done by modularizing code into gadgets. Alternatively one can use mw.loader.using inline. Previously mw.util was usually loaded before 'site'. It can happen that 'site' arrives first. Order is (and should be) asynchronous, dependency declaration is mandatory. > 2. despite wrapping all inside mw.loader.using('mediawiki.util', function(){ > mw.util.$content is null. But it shouldn’t since the code wrapped inside > mw.loader.using('mediawiki.util'... should be executed after mw.util is > initialized There is a difference between mw.util being undefined and mw.util.$content being null. mw.util is defined in the mediawiki.util module, which can be at any point in time. Including before the body content is parsed. For that reason mediawiki.util is and always has populated mw.util.$content from a document-ready hook. Again, due to things loading faster now (yay), it is even more important that less is assumed and more is declared. I've reverted Rillke's changed to MediaWiki:Common.js on commons.wikimedia.beta.wmflabs back to the original, and wrapped it in mw.loader.using. Since mw.util.$content wasn't used there it's fine now. It is used within a $(document).ready hook but that's fine. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
