Ticket #4611: 4611.patch
File 4611.patch, 1.3 KB (added by , 13 years ago) |
---|
-
_source/plugins/selection/plugin.js
486 486 // IE report line break as CRLF with range.text but 487 487 // only LF with textnode.nodeValue, normalize them to avoid 488 488 // breaking character counting logic below. (#3949) 489 var distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length; 489 var textInRange = testRange.text, 490 htmlInRange = testRange.htmlText, 491 distance = textInRange.replace( /(\r\n|\r)/g, '\n' ).length; 490 492 493 // Sometimes the above distance is incorrectly counting content within 494 // uneditable elements (e.g. [<select><option>text</option></select>] 495 // will be counted up to 4), counting again in with different approach. (#4611) 496 if( htmlInRange.length != textInRange.length ) 497 { 498 for( var characters = 0; testRange.text.length 499 && testRange.compareEndPoints( 'EndToStart', range ); characters++ ) 500 testRange.moveEnd( 'character', -1 ); 501 502 distance = Math.min( distance, characters ); 503 } 504 505 491 506 while ( distance > 0 ) 492 507 distance -= siblings[ --i ].nodeValue.length; 493 508