[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 --- Comment #23 from Erwin Dokter er...@darcoury.nl 2012-02-02 12:27:20 UTC --- Now that mw.util is loaded at the top as a dependency of mw.page.startup, does this not in fact negate bug 33746/r110254 ? -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 Krinkle krinklem...@gmail.com changed: What|Removed |Added Keywords|need-review, patch | Status|REOPENED|ASSIGNED -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 Krinkle krinklem...@gmail.com changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED --- Comment #22 from Krinkle krinklem...@gmail.com 2012-02-02 00:48:48 UTC --- Resolved in r110542. Advanced callback system will also soon be done by bug 23580. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 Mark A. Hershberger m...@everybody.org changed: What|Removed |Added Target Milestone|--- |1.19wmf deployment -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 Krinkle krinklem...@gmail.com changed: What|Removed |Added AssignedTo|wikibugs-l@lists.wikimedia. |krinklem...@gmail.com |org | -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 --- Comment #20 from Michael M. listenle...@gmail.com 2012-01-24 09:41:09 UTC --- Created attachment 9900 -- https://bugzilla.wikimedia.org/attachment.cgi?id=9900 Patch for a simple implementation The patch just does what I suggested in comment 17. Please note that I ran into huge troubles with the edit toolbar, I opened bug 33922 for this. Feel free to do whatever you think should be done with the patch. -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 --- Comment #21 from Michael M. listenle...@gmail.com 2012-01-24 09:42:05 UTC --- Created attachment 9901 -- https://bugzilla.wikimedia.org/attachment.cgi?id=9901 Sample MediaWiki:Common.js Example MediaWiki:Common.js to show that/how it works. -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 Michael M. listenle...@gmail.com changed: What|Removed |Added Keywords||need-review, patch -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 --- Comment #17 from Michael M. listenle...@gmail.com 2012-01-23 08:19:18 UTC --- I think I found a good solution for the problem. I didn't test it, but it should work and additionally solve several other bugs (bug 30713, bug 33399): 1. In mediawiki.util.js create a jQuery.Callback( 'memory' ) and make it a public member of mw.util, perhaps as mw.util.callback 2. In mediawiki.page.ready.js call mw.util.callback.fire() for it after mw.util.$content has been initialized. 3. Whenever the content is changed (at least Live Preview does this) call mw.util.callback.fire() again. 4. Replace $( document ).ready( callback ) with mw.util.callback.add( callback ) everywhere where the callback relies on $content and should be called when the content changes (in mediawiki.page.ready.js at least makeCollapsible and tablesorter). -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 Rob Lanphier ro...@wikimedia.org changed: What|Removed |Added CC||ro...@wikimedia.org --- Comment #18 from Rob Lanphier ro...@wikimedia.org 2012-01-23 22:45:48 UTC --- Is this a duplicate of bug 33746? -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 --- Comment #19 from Krinkle krinklem...@gmail.com 2012-01-23 22:51:58 UTC --- (In reply to comment #18) Is this a duplicate of bug 33746? No, the users reporting this bug do have the module loaded. But a certain variable isn't initialized when accessed before the document is ready. (In reply to comment #17) I think I found a good solution for the problem. I didn't test it, but it should work and additionally solve several other bugs (bug 30713, bug 33399): 1. In mediawiki.util.js create a jQuery.Callback( 'memory' ) a [...] The general concept of these kind of hooks is good, but I'd rather not do it ad hoc inside mw.util. There is is a general bug about the need for this, among the reasons is the ability to have ajax preview represent a normal view by having javascript handlers run on a 'mw.wikipage.onload' hook instead of window.document.ondomready. This is requested in bug 23580 and in bug 23580 comment 13 I had the same idea as you, using jQuery.Callbacks indeed. -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 Michael M. listenle...@gmail.com changed: What|Removed |Added CC||listenle...@gmail.com --- Comment #13 from Michael M. listenle...@gmail.com 2012-01-20 11:43:28 UTC --- mw.util.$content is initialized by mediawiki.page.ready, so if you need mw.util.$content, you should register $(document).ready after mediawiki.page.ready does so. So I think it will work if you wrap the whole code into mw.loader.using(['mediawiki.util', 'mediawiki.page.ready'], function () { }); (which I didn't try and which seems ugly to me). -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 --- Comment #14 from Krinkle krinklem...@gmail.com 2012-01-20 11:44:30 UTC --- document-ready is a jQuery event (queue). Both your handler and the mw.util.init are added to that queue. Depending on in which order jQuery executes them, it will mean that for your script it's undefined or not. I remember a bug about this a few months back and we fixed (it was a bug about the unit test being unable to test the initializer becuase it initilized upon loading the script). As a good practice its recommended to separate the definitions of methods and actually executing code, and so we (I) did. As a result the mediawiki.page.ready module was added, which would actually initilize stuff (i.e. one should be able to load jquery.checkboxShiftClick without having it do something by default that can't be undone). However this doesn't change the fact that document-ready is still an event queue of which the order is practically uncontrollable. Wrapping the mw.loader.using call inside document-ready instead of the other way around doens't sound like something that should work or is supported so I don't recommend relying on that. It actually seems even counter-intuitive as it would add it to the queue before loading mw.util which would enqueue itself after yours. Anyway I remember a fix for this, but I can't think of what it was. I'll take a fresh look at this tonight. -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 Krinkle krinklem...@gmail.com changed: What|Removed |Added CC||krinklem...@gmail.com --- Comment #15 from Krinkle krinklem...@gmail.com 2012-01-20 11:46:48 UTC --- (mid-air collision) (In reply to comment #10) (In reply to comment #8) Since mw.util.$content wasn't used there it's fine now. It is used within a $(document).ready hook but that's fine. Krinkle thinks that when adding a dependency to mw.util AND wrapping the code accessing mw.util.$content inside a $(document).ready(function(){...}) or its short form $(function(){...}), mw.util.$content must be defined, which is not the case here why I reopened the bug. That is indeed what I thought. Having mw.util available is good, but $content isn't available until document-ready. init() is being ccalled in document-ready, becuase before that event there is nothing $content can be set to, the elements need to exist before they can be selected and cached in $content. -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 --- Comment #16 from Erwin Dokter er...@darcoury.nl 2012-01-20 14:07:41 UTC --- Why not make $content a function queued in document.ready? That should ensure it always returns populated. -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 Erwin Dokter er...@darcoury.nl changed: What|Removed |Added Summary|mw.util is undefined in |mw.util.$content is |MediaWiki:Common.js |undefined in ||MediaWiki:Common.js -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 --- Comment #10 from rai...@rillke.eu rainerril...@hotmail.com 2012-01-19 21:12:17 UTC --- (In reply to comment #8) Your logic fails... $ and $content are unrelated. I suggest you read the changes Krinkle made. I know that they are not the same. But you should also read what Krinkle wrote here: Since mw.util.$content wasn't used there it's fine now. It is used within a $(document).ready hook but that's fine. Krinkle thinks that when adding a dependency to mw.util AND wrapping the code accessing mw.util.$content inside a $(document).ready(function(){...}) or its short form $(function(){...}), mw.util.$content must be defined, which is not the case here why I reopened the bug. http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/resources/mediawiki/mediawiki.util.js?view=markup#l58 If you look at the source-code of the mw.util -module you will see that $content is predefined with null and there is a init-method that sets $content to what it should be. The problem? is that init can only be invoked by $(document).ready() because RL-modules may be loaded before the DOM is ready. So the question to solve is, why mw.util.$content is null. 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. http://commons.wikimedia.beta.wmflabs.org/w/index.php?title=MediaWiki%3ACommon.jsdiff=22461oldid=22442 sans commentaire -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 --- Comment #11 from Erwin Dokter er...@darcoury.nl 2012-01-19 23:23:45 UTC --- Also interesting: /** * Initialisation * (don't call before document ready) */ init: function() { ... I don't *when* RL calls init, but is it is before document.ready, perhaps we will have to wrap common.js itself in $(document).ready, then load util within. -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 33711] mw.util.$content is undefined in MediaWiki:Common.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=33711 --- Comment #12 from Erwin Dokter er...@darcoury.nl 2012-01-20 00:31:48 UTC --- Wrapping mw.loader.using() itself in a $(document).ready works: Begin of Common.js: mw.util.$content is object [div id=bodyContent.../div] Begin of Common.js: #bodyContent is object [div id=bodyContent.../div] How does ResourceLoader ensures document.ready before loading mw.util? If it doesn't, then $content will never be properly defined. -- 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 Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l