Ticket #4690: 4690_3.patch
File 4690_3.patch, 2.0 KB (added by , 14 years ago) |
---|
-
_source/core/htmlparser/fragment.js
264 264 265 265 parser.onTagClose = function( tagName ) 266 266 { 267 var index = 0, 268 pendingAdd = [], 267 // Check if there is any pending tag to be closed. 268 for ( var i = pendingInline.length - 1 ; i >= 0 ; i-- ) 269 { 270 // If found, just remove it from the list. 271 if ( tagName == pendingInline[ i ].name ) 272 { 273 pendingInline.splice( i, 1 ); 274 return; 275 } 276 } 277 278 var pendingAdd = [], 269 279 candidate = currentNode; 270 280 271 281 while ( candidate.type && candidate.name != tagName ) … … 273 283 // If this is an inline element, add it to the pending list, so 274 284 // it will continue after the closing tag. 275 285 if ( !candidate._.isBlockLike ) 276 {277 286 pendingInline.unshift( candidate ); 278 287 279 // Increase the index, so it will not get checked again in280 // the pending list check that follows.281 index++;282 }283 284 288 // This node should be added to it's parent at this point. But, 285 289 // it should happen only if the closing tag is really closing 286 290 // one of the nodes. So, for now, we just cache it. … … 310 314 if ( candidate == currentNode ) 311 315 currentNode = currentNode.parent; 312 316 } 313 // The tag is not actually closing anything, thus we need invalidate314 // the pending elements.(#3862)315 else316 {317 pendingInline.splice( 0, index );318 index = 0;319 }320 321 // Check if there is any pending tag to be closed.322 for ( ; index < pendingInline.length ; index++ )323 {324 // If found, just remove it from the list.325 if ( tagName == pendingInline[ index ].name )326 {327 pendingInline.splice( index, 1 );328 329 // Decrease the index so we continue from the next one.330 index--;331 }332 }333 317 }; 334 318 335 319 parser.onText = function( text )