X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fcore%2Fdom%2Felement.js;h=10b9cd21c3ba61aa9ad4cc6e1cb57e2f9dc8954b;hp=84498ba72b4080b372777ac9cfe8155f12826e87;hb=fb481ba0a7d298e3e7b9034fcb9f2afdc6e8e796;hpb=6e682412d5cc0dfaedb376482e585bf2989c6863 diff --git a/_source/core/dom/element.js b/_source/core/dom/element.js index 84498ba..10b9cd2 100644 --- a/_source/core/dom/element.js +++ b/_source/core/dom/element.js @@ -105,6 +105,9 @@ CKEDITOR.dom.element.clearMarkers = function( database, element, removeFromDatab } }; +( function() +{ + CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype, /** @lends CKEDITOR.dom.element.prototype */ { @@ -504,7 +507,10 @@ CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype, : function( propertyName ) { - return this.getWindow().$.getComputedStyle( this.$, '' ).getPropertyValue( propertyName ); + var style = this.getWindow().$.getComputedStyle( this.$, null ); + + // Firefox may return null if we call the above on a hidden iframe. (#9117) + return style ? style.getPropertyValue( propertyName ) : ''; }, /** @@ -1186,6 +1192,16 @@ CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype, { // Removes the specified property from the current style object. var $ = this.$.style; + + // "removeProperty" need to be specific on the following styles. + if ( !$.removeProperty && ( name == 'border' || name == 'margin' || name == 'padding' ) ) + { + var names = expandedRules( name ); + for ( var i = 0 ; i < names.length ; i++ ) + this.removeStyle( names[ i ] ); + return; + } + $.removeProperty ? $.removeProperty( name ) : $.removeAttribute( CKEDITOR.tools.cssStyleToDomStyle( name ) ); if ( !this.$.style.cssText ) @@ -1752,13 +1768,35 @@ CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype, } }); -( function() -{ var sides = { width : [ "border-left-width", "border-right-width","padding-left", "padding-right" ], height : [ "border-top-width", "border-bottom-width", "padding-top", "padding-bottom" ] }; + // Generate list of specific style rules, applicable to margin/padding/border. + function expandedRules( style ) + { + var sides = [ 'top', 'left', 'right', 'bottom' ], components; + + if ( style == 'border' ) + components = [ 'color', 'style', 'width' ]; + + var styles = []; + for ( var i = 0 ; i < sides.length ; i++ ) + { + + if ( components ) + { + for ( var j = 0 ; j < components.length ; j++ ) + styles.push( [ style, sides[ i ], components[j] ].join( '-' ) ); + } + else + styles.push( [ style, sides[ i ] ].join( '-' ) ); + } + + return styles; + } + function marginAndPaddingSize( type ) { var adjustment = 0;