/*\r
-Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
}\r
};\r
\r
+( function()\r
+{\r
+\r
CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype,\r
/** @lends CKEDITOR.dom.element.prototype */\r
{\r
case 'style':\r
// IE does not return inline styles via getAttribute(). See #2947.\r
return this.$.style.cssText;\r
+\r
+ case 'contenteditable':\r
+ case 'contentEditable':\r
+ return this.$.attributes.getNamedItem( 'contentEditable' ).specified ?\r
+ this.$.getAttribute( 'contentEditable' ) : null;\r
}\r
\r
return standard.call( this, name );\r
:\r
function( propertyName )\r
{\r
- return this.getWindow().$.getComputedStyle( this.$, '' ).getPropertyValue( propertyName );\r
+ var style = this.getWindow().$.getComputedStyle( this.$, null );\r
+\r
+ // Firefox may return null if we call the above on a hidden iframe. (#9117)\r
+ return style ? style.getPropertyValue( propertyName ) : '';\r
},\r
\r
/**\r
|| this.getComputedStyle( 'display' ) == 'none'\r
|| this.getComputedStyle( 'visibility' ) == 'hidden'\r
|| this.is( 'a' ) && this.data( 'cke-saved-name' ) && !this.getChildCount()\r
- || CKEDITOR.dtd.$nonEditable[ name ] )\r
+ || CKEDITOR.dtd.$nonEditable[ name ]\r
+ || CKEDITOR.dtd.$empty[ name ] )\r
{\r
return false;\r
}\r
this.$.tabIndex = value;\r
else if ( name == 'checked' )\r
this.$.checked = value;\r
+ else if ( name == 'contenteditable' )\r
+ standard.call( this, 'contentEditable', value );\r
else\r
standard.apply( this, arguments );\r
return this;\r
name = 'className';\r
else if ( name == 'tabindex' )\r
name = 'tabIndex';\r
+ else if ( name == 'contenteditable' )\r
+ name = 'contentEditable';\r
standard.call( this, name );\r
};\r
}\r
*/\r
removeStyle : function( name )\r
{\r
- this.setStyle( name, '' );\r
- if ( this.$.style.removeAttribute )\r
- this.$.style.removeAttribute( CKEDITOR.tools.cssStyleToDomStyle( name ) );\r
+ // Removes the specified property from the current style object.\r
+ var $ = this.$.style;\r
+\r
+ // "removeProperty" need to be specific on the following styles.\r
+ if ( !$.removeProperty && ( name == 'border' || name == 'margin' || name == 'padding' ) )\r
+ {\r
+ var names = expandedRules( name );\r
+ for ( var i = 0 ; i < names.length ; i++ )\r
+ this.removeStyle( names[ i ] );\r
+ return;\r
+ }\r
+\r
+ $.removeProperty ? $.removeProperty( name ) : $.removeAttribute( CKEDITOR.tools.cssStyleToDomStyle( name ) );\r
\r
if ( !this.$.style.cssText )\r
this.removeAttribute( 'style' );\r
*/\r
setOpacity : function( opacity )\r
{\r
- if ( CKEDITOR.env.ie )\r
+ if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )\r
{\r
opacity = Math.round( opacity * 100 );\r
this.setStyle( 'filter', opacity >= 100 ? '' : 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacity + ')' );\r
}\r
});\r
\r
-( function()\r
-{\r
var sides = {\r
width : [ "border-left-width", "border-right-width","padding-left", "padding-right" ],\r
height : [ "border-top-width", "border-bottom-width", "padding-top", "padding-bottom" ]\r
};\r
\r
+ // Generate list of specific style rules, applicable to margin/padding/border.\r
+ function expandedRules( style )\r
+ {\r
+ var sides = [ 'top', 'left', 'right', 'bottom' ], components;\r
+\r
+ if ( style == 'border' )\r
+ components = [ 'color', 'style', 'width' ];\r
+\r
+ var styles = [];\r
+ for ( var i = 0 ; i < sides.length ; i++ )\r
+ {\r
+\r
+ if ( components )\r
+ {\r
+ for ( var j = 0 ; j < components.length ; j++ )\r
+ styles.push( [ style, sides[ i ], components[j] ].join( '-' ) );\r
+ }\r
+ else\r
+ styles.push( [ style, sides[ i ] ].join( '-' ) );\r
+ }\r
+\r
+ return styles;\r
+ }\r
+\r
function marginAndPaddingSize( type )\r
{\r
var adjustment = 0;\r