Ticket #8520: 8520.patch
File 8520.patch, 3.0 KB (added by , 12 years ago) |
---|
-
_source/core/dom/node.js
231 231 return new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument ); 232 232 }, 233 233 234 getIndex : function( normalized )234 getIndex : CKEDITOR.env.ie && CKEDITOR.env.version < 9 ? function( normalized ) 235 235 { 236 236 // Attention: getAddress depends on this.$ 237 237 238 var parent = this.$.parentNode, 239 childs = parent.childNodes, 240 count = childs.length, 241 current, 242 index = 0; 243 244 for ( var i = 0; i < count; i++ ) 245 { 246 if ( ( current = childs[ i ] ) == this.$ ) 247 break; 248 249 // sibling traversal may throw exceptions in old IEs. 250 try 251 { 252 // When normalizing, do not count it if this is an 253 // empty text node or if it's a text node following another one. 254 if ( normalized && current.nodeType == 3 && 255 ( !current.nodeValue.length || 256 ( current.previousSibling && current.previousSibling.nodeType == 3 ) ) ) 257 { 258 continue; 259 } 260 } 261 catch(er){} 262 263 index++; 264 } 265 266 return index; 267 } 268 : 269 function( normalized ) 270 { 271 // Attention: getAddress depends on this.$ 272 238 273 var current = this.$, 239 274 index = 0; 240 275 -
_source/plugins/selection/plugin.js
730 730 return { container : parent, offset : 0 }; 731 731 732 732 var siblings = parent.children, 733 childNodes = parent.childNodes, 733 734 child, 734 735 sibling, 735 736 testRange = range.duplicate(), … … 820 821 if ( !distance ) 821 822 return { container : parent, offset : getNodeIndex( child ) + ( position > 0 ? 0 : 1 ) }; 822 823 824 i = getNodeIndex( child ); 823 825 // Start the measuring until distance overflows, meanwhile count the text nodes. 824 826 while ( distance > 0 ) 825 827 { 826 828 try 827 829 { 828 sibling = child[ position > 0 ? 'previousSibling' : 'nextSibling' ]; 830 sibling = childNodes[ i -= position ]; 831 // Fix an exception when node value access on certain IE internal marker (~) got it broken. (#8520) 829 832 distance -= sibling.nodeValue.length; 830 833 child = sibling; 831 834 } 832 // Measurement in IE could be somtimes wrong because of <select> element. (#4611)833 835 catch( e ) 834 836 { 835 return { container : parent, offset : getNodeIndex( child ) }; 836 } 837 } 837 // Fix an exception with wrong measurement in IE < 8 because of <select> element. (#4611) 838 if ( !sibling ) 839 { 840 return { container : parent, offset : getNodeIndex( child ) }; 841 } 842 } 843 } 838 844 839 845 return { container : child, offset : position > 0 ? -distance : child.nodeValue.length + distance }; 840 846 }