Ticket #7260: 7260.patch
File 7260.patch, 1.5 KB (added by , 13 years ago) |
---|
-
_source/core/dom/node.js
210 210 { 211 211 // Get the node index. For performance, call getIndex 212 212 // directly, instead of creating a new node object. 213 address. unshift( this.getIndex.call( { $ : node }, normalized ) );213 address.push( this.getIndex.call( { $ : node }, normalized ) ); 214 214 } 215 215 216 216 node = parentNode; 217 217 } 218 218 219 return address; 219 // Reverse the array instead of doing 'unshift' as for it's poor performance. (#7260) 220 return address.reverse(); 220 221 }, 221 222 222 223 /** … … 393 394 return ( parent && parent.nodeType == 1 ) ? new CKEDITOR.dom.node( parent ) : null; 394 395 }, 395 396 397 /** 398 * Retrieve all ancestors from this element up till the document element. 399 * @param {Boolean} [closerFirst=false] Whether closer ancestors stay in front of the result list. 400 */ 396 401 getParents : function( closerFirst ) 397 402 { 398 403 var node = this; … … 400 405 401 406 do 402 407 { 403 parents [ closerFirst ? 'push' : 'unshift' ]( node );408 parents.push( node ); 404 409 } 405 while ( ( node = node.getParent() ) ) 410 while ( ( node = node.getParent() ) ); 406 411 407 return parents; 412 // Reverse the array instead of doing 'unshift' as for it's poor performance. (#7260) 413 return closerFirst ? parents : parents.reverse(); 408 414 }, 409 415 410 416 getCommonAncestor : function( node )