Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -332,16 +332,18 @@ |
333 | 333 | }; |
334 | 334 | |
335 | 335 | window.getInnerText = function( el ) { |
336 | | - if ( el.getAttribute( 'data-sort-value' ) !== null ) { |
337 | | - return el.getAttribute( 'data-sort-value' ); |
338 | | - } |
339 | | - |
340 | 336 | if ( typeof el == 'string' ) { |
341 | 337 | return el; |
342 | 338 | } |
343 | 339 | if ( typeof el == 'undefined' ) { |
344 | 340 | return el; |
345 | 341 | } |
| 342 | + // Custom sort value through 'data-sort-value' attribute |
| 343 | + // (no need to prepend hidden text to change sort value) |
| 344 | + if ( el.nodeType && el.getAttribute( 'data-sort-value' ) !== null ) { |
| 345 | + // Make sure it's a valid DOM element (.nodeType) and that the attribute is set (!null) |
| 346 | + return el.getAttribute( 'data-sort-value' ); |
| 347 | + } |
346 | 348 | if ( el.textContent ) { |
347 | 349 | return el.textContent; // not needed but it is faster |
348 | 350 | } |