\r
// Save the current state, so it can be compared next\r
// time.\r
- callback.state !== currentState;\r
+ callback.state = currentState;\r
}\r
}\r
});\r
}\r
\r
- // Save the callback info, so it can be checked on the next occurence of\r
+ // Save the callback info, so it can be checked on the next occurrence of\r
// selectionChange.\r
styleStateChangeCallbacks.push( { style : style, fn : callback } );\r
};\r
return false;\r
},\r
\r
+ /**\r
+ * Whether this style can be applied at the element path.\r
+ * @param elementPath\r
+ */\r
checkApplicable : function( elementPath )\r
{\r
switch ( this.type )\r
continue;\r
\r
var elementAttr = element.getAttribute( attName ) || '';\r
+\r
+ // Special treatment for 'style' attribute is required.\r
if ( attName == 'style' ?\r
compareCssText( attribs[ attName ], normalizeCssText( elementAttr, false ) )\r
: attribs[ attName ] == elementAttr )\r
}\r
}\r
\r
+ var nonWhitespaces = CKEDITOR.dom.walker.whitespaces( true );\r
/**\r
* Merge a <pre> block with a previous sibling if available.\r
*/\r
function mergePre( preBlock )\r
{\r
var previousBlock;\r
- if ( !( ( previousBlock = preBlock.getPreviousSourceNode( true, CKEDITOR.NODE_ELEMENT ) )\r
+ if ( !( ( previousBlock = preBlock.getPrevious( nonWhitespaces ) )\r
&& previousBlock.is\r
&& previousBlock.is( 'pre') ) )\r
return;\r
return overrides;\r
}\r
\r
+ // Make the comparison of attribute value easier by standardizing it.\r
function normalizeProperty( name, value, isStyle )\r
{\r
var temp = new CKEDITOR.dom.element( 'span' );\r
return temp[ isStyle ? 'getStyle' : 'getAttribute' ]( name );\r
}\r
\r
+ // Make the comparison of style text easier by standardizing it.\r
function normalizeCssText( unparsedCssText, nativeNormalize )\r
{\r
var styleText;\r
return retval;\r
}\r
\r
+ /**\r
+ * Compare two bunch of styles, with the speciality that value 'inherit'\r
+ * is treated as a wildcard which will match any value.\r
+ * @param {Object|String} source\r
+ * @param {Object|String} target\r
+ */\r
function compareCssText( source, target )\r
{\r
typeof source == 'string' && ( source = parseStyleText( source ) );\r
typeof target == 'string' && ( target = parseStyleText( target ) );\r
for( var name in source )\r
{\r
- // Value 'inherit' is treated as a wildcard,\r
- // which will match any value.\r
if ( !( name in target &&\r
( target[ name ] == source[ name ]\r
|| source[ name ] == 'inherit'\r