Reedy has submitted this change and it was merged. Change subject: Various javascript optimizations (fixes bug 39959) ......................................................................
Various javascript optimizations (fixes bug 39959) * (bug 39959) Right click to edit section causing browser hangs The :has() selector has gotten significantly slower in jQuery 1.8.1 however the reason it affected us so much is partly because of the very inefficient way we used it. Namely duplicated 6 times and evaluated from a live() binding In order words, on every instance of the event. Optimizing by - only select headings, do the :has implicitly by checking for the result of .find(). - document.on(.., selector) instead of .live() - remove redundant and overkill 'return false' Results in Firefox 15/Chrome 21: - up to 130x (one hundred and thirty) faster! * /resources/* (except for third party libs) - Use .on() instead of bind, delegate or live - Use .off() instead of unbind, undelegate or die - Use document.getElementById instead of $('#' + variable) not for performance but for predictability/security. (e.g. rel="foo.bar" should select id="foo.bar" not id="foo" class="bar") - Fix some minor whitespace and code conventions. Change-Id: I2fefb5376d0de40f4997a3a1763eee23fcd3e7fa --- M resources/jquery/jquery.makeCollapsible.js M resources/jquery/jquery.placeholder.js M resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js M resources/mediawiki/mediawiki.htmlform.js M skins/common/config.js 5 files changed, 67 insertions(+), 55 deletions(-) Approvals: Reedy: Verified; Looks good to me, approved -- To view, visit https://gerrit.wikimedia.org/r/23532 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2fefb5376d0de40f4997a3a1763eee23fcd3e7fa Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: wmf/1.20wmf10 Gerrit-Owner: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: Krinkle <ttij...@wikimedia.org> Gerrit-Reviewer: Reedy <re...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits