Ticket #3450: 3450_2.patch
File 3450_2.patch, 3.3 KB (added by , 15 years ago) |
---|
-
_source/core/dom/element.js
430 430 431 431 case 'style': 432 432 // IE does not return inline styles via getAttribute(). See #2947. 433 return this.$.style.cssText; 433 var styleText = this.$.style.cssText; 434 styleText.toLowerCase(); 435 styleText.replace( /\s+/g, '' ); 436 styleText.replace( /\s*(?:;\s*|$)/, ';'); 437 styleText.replace( /([^;])$/, '$1;'); 438 return styleText; 434 439 } 435 440 436 441 return standard.call( this, name ); -
_source/plugins/styles/plugin.js
197 213 { 198 214 if ( attName == '_length' ) 199 215 continue; 200 201 if ( compareAttributeValues(attName, attribs[attName], element.getAttribute( attName ) ) ) 216 if ( attribs[attName] == element.getAttribute( attName ) ) 202 217 { 203 218 if ( !fullMatch ) 204 219 return true; … … 269 284 // Browsers make some changes to the style when applying them. So, here 270 285 // we normalize it to the browser format. 271 286 if ( stylesText.length ) 272 {273 287 stylesText = normalizeCssText( stylesText ); 274 275 if ( stylesText.length ) 276 stylesText = stylesText.replace( semicolonFixRegex, ';' ); 277 } 278 288 279 289 // Return it, saving it to the next request. 280 290 return ( styleDefinition._ST = stylesText ); 281 291 }; … … 889 893 } 890 894 } 891 895 892 var spacesRegex = /\s+/g;893 894 896 // Returns an object that can be used for style matching comparison. 895 897 // Attributes names and values are all lowercased, and the styles get 896 898 // merged with the style attribute. … … 918 920 919 921 // Includes the style definitions. 920 922 var styleText = CKEDITOR.style.getStyleText( styleDefinition ); 921 if ( styleText .length > 0)923 if ( styleText ) 922 924 { 923 925 if ( !attribs[ 'style' ] ) 924 926 length++; 925 926 attribs['style'] = styleText.replace( spacesRegex, '' ).toLowerCase(); 927 attribs[ 'style' ] = styleText; 927 928 } 928 929 929 930 // Appends the "length" information to the object. … … 1001 1002 { 1002 1003 // Injects the style in a temporary span object, so the browser parses it, 1003 1004 // retrieving its final format. 1004 var tempSpan = document.createElement( 'span' ); 1005 tempSpan.style.cssText = unparsedCssText; 1006 return tempSpan.style.cssText; 1007 } 1008 1009 // valueA is our internal "for comparison" value. 1010 // valueB is the value retrieved from the element. 1011 function compareAttributeValues( attName, valueA, valueB ) 1012 { 1013 if ( valueA == valueB || ( !valueA && !valueB ) ) 1014 return true; 1015 else if ( !valueA || !valueB ) 1016 return false; 1017 1018 valueB = valueB.toLowerCase(); 1019 1020 if ( attName == 'style' ) 1021 { 1022 valueB = valueB.replace( spacesRegex, '' ); 1023 if ( valueB.charAt( valueB.length - 1 ) != ';' ) 1024 valueB += ';'; 1025 } 1026 1027 // Return true if they match or if valueA is null and valueB is an empty string 1028 return ( valueA == valueB ); 1005 var temp = new CKEDITOR.dom.element( 'span' ); 1006 temp.setAttribute( 'style', unparsedCssText ); 1007 return temp.getAttribute( 'style' ); 1029 1008 } 1030 1009 1031 1010 function applyStyle( document, remove )