mediawiki.util: Optimise logic in addPortletLink
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 1 Aug 2013 23:38:16 +0000 (01:38 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Fri, 2 Aug 2013 03:32:09 +0000 (05:32 +0200)
Optimised to no longer:
* boolean cast "nextnode" twice.
* assert nextnode.jquery when we know it is a jQuery object.
  > !!$( Node ).jquery
* assert nextnode.length when we know it has only 1 element.
  > $( Node ).length === 1
* execute $ul.find( selector ) twice for the CSS selector case.
* check for .length in some places and do an ignorant eq(0) in
  other cases (thus ignoring the case if there are multiple
  elements).

Tests still pass :-)

Change-Id: Ibc86c2dc33a8a3ba378138525c2523ba69bca8f1


No differences found