@@ -197,8 +197,7 @@
{
if ( attName == '_length' )
continue;
-
- if ( compareAttributeValues(attName, attribs[attName], element.getAttribute( attName ) ) )
+ if ( attribs[attName] == element.getAttribute( attName ) )
{
if ( !fullMatch )
return true;
@@ -269,13 +268,8 @@
// Browsers make some changes to the style when applying them. So, here
// we normalize it to the browser format.
if ( stylesText.length )
- {
stylesText = normalizeCssText( stylesText );
-
+
- if ( stylesText.length )
- stylesText = stylesText.replace( semicolonFixRegex, ';' );
- }
-
// Return it, saving it to the next request.
return ( styleDefinition._ST = stylesText );
};
@@ -918,12 +912,12 @@
// Includes the style definitions.
var styleText = CKEDITOR.style.getStyleText( styleDefinition );
- if ( styleText.length > 0 )
+ if ( styleText )
{
if ( !attribs[ 'style' ] )
length++;
- attribs['style'] = styleText.replace( spacesRegex, '' ).toLowerCase();
+ attribs['style'] = styleText.replace( spacesRegex, '' );
}
// Appends the "length" information to the object.
@@ -1001,33 +995,11 @@
{
// Injects the style in a temporary span object, so the browser parses it,
// retrieving its final format.
- var tempSpan = document.createElement( 'span' );
- tempSpan.style.cssText = unparsedCssText;
- return tempSpan.style.cssText;
+ var temp = new CKEDITOR.dom.element( 'span' );
+ temp.setAttribute( 'style', unparsedCssText );
+ return temp.getAttribute( 'style' );
}
- // valueA is our internal "for comparison" value.
- // valueB is the value retrieved from the element.
- function compareAttributeValues( attName, valueA, valueB )
- {
- if ( valueA == valueB || ( !valueA && !valueB ) )
- return true;
- else if ( !valueA || !valueB )
- return false;
-
- valueB = valueB.toLowerCase();
-
- if ( attName == 'style' )
- {
- valueB = valueB.replace( spacesRegex, '' );
- if ( valueB.charAt( valueB.length - 1 ) != ';' )
- valueB += ';';
- }
-
- // Return true if they match or if valueA is null and valueB is an empty string
- return ( valueA == valueB );
- }
-
function applyStyle( document, remove )
{
// Get all ranges from the selection.
|
|
|
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 | return styleText.toLowerCase().replace( |
| 435 | /\s*(?:;\s*|$)/, ';').replace( |
| 436 | /([^;])$/, '$1;'); |
434 | 437 | } |
435 | 438 | |
436 | 439 | return standard.call( this, name ); |