https://bugzilla.wikimedia.org/show_bug.cgi?id=23580
Krinkle <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |[email protected] Resolution|FIXED | --- Comment #10 from Krinkle <[email protected]> 2011-09-17 18:33:09 UTC --- (In reply to comment #8) > Some examples of gotchas for jQuery base bind / trigger > > var o = {length: 3}; > $(o).bind( 'custom', function(){ console.log('hi') } ); > $(o).trigger('custom'); > > // Output > hi > hi > hi Throws TypeError as of jQuery 1.6+, presumably because it's looping through 'o' and finds [0], [1] and [2] to be undefined. Suggest we revert r66721 and possibly other similar implementations and instead create a mediawiki.hook module. ie. mw.hooks.run( 'key', .., .. ); mw.hooks.add( 'key', fn ); That way different parts of the pages build up can tab into different events and hooks (instead or relying on the over-used "document ready" event. For example: * 'outputPage.bodyContentReady' - (args: $bodyContent ): Run after <div id="bodyContent"> has been populated. Called once on a normal page, and re-called in special circumstances (ie. after live preview is injected). Scripts like tablesorters and collapsiblemakers would then hook into this, instead of document-ready to do their stuff. -- 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 [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
