Follow-up r73270. Moving the attribute check down to the point where it's for sure...
authorKrinkle <krinkle@users.mediawiki.org>
Mon, 21 Feb 2011 20:36:07 +0000 (20:36 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Mon, 21 Feb 2011 20:36:07 +0000 (20:36 +0000)
skins/common/wikibits.js

index c70556e..b862f5c 100644 (file)
@@ -332,16 +332,18 @@ window.addPortletLink = function( portlet, href, text, id, tooltip, accesskey, n
 };
 
 window.getInnerText = function( el ) {
-       if ( el.getAttribute( 'data-sort-value' ) !== null ) {
-               return el.getAttribute( 'data-sort-value' );
-       }
-       
        if ( typeof el == 'string' ) {
                return el;
        }
        if ( typeof el == 'undefined' ) {
                return el;
        }
+       // Custom sort value through 'data-sort-value' attribute
+       // (no need to prepend hidden text to change sort value)
+       if ( el.nodeType && el.getAttribute( 'data-sort-value' ) !== null ) {
+               // Make sure it's a valid DOM element (.nodeType) and that the attribute is set (!null)
+               return el.getAttribute( 'data-sort-value' );
+       }
        if ( el.textContent ) {
                return el.textContent; // not needed but it is faster
        }