Ticket #3693: 3693.patch
File 3693.patch, 1.7 KB (added by , 14 years ago) |
---|
-
_source/core/dom/element.js
1 /*1 /* 2 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ … … 397 397 { 398 398 var standard = function( name ) 399 399 { 400 return this.$.getAttribute( name, 2 ); 400 // Format styles for IE (all up to IE8 strict) and webkit (up to chrome2) 401 return ( CKEDITOR.env.webkit || CKEDITOR.env.ie ) && name == 'style' 402 ? filterStyles( this.$.getAttribute( name, 2 ) ) 403 : this.$.getAttribute( name, 2 ); 401 404 }; 402 405 406 var filterStyles = function( styles ) 407 { 408 return styles 409 // 1. Lower case property name. 410 // 2. Add space after colon. 411 .replace( /(?:^|;)\s*([A-Z-_]+)(:\s*)/ig, function( match, property, colon ) 412 { 413 return property.toLowerCase() + ': '; 414 } ) 415 // 3. Strip whitepsaces around semicolon. 416 .replace( /\s+(?:;\s*|$)/g, ';' ) 417 // 4. Always end with semicolon 418 .replace( /([^;])$/g, '$1;' 419 ); 420 }; 421 403 422 if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) ) 404 423 { 405 424 return function( name ) … … 430 449 431 450 case 'style': 432 451 // IE does not return inline styles via getAttribute(). See #2947. 433 var styleText = this.$.style.cssText; 434 return styleText.toLowerCase().replace( 435 /\s*(?:;\s*|$)/, ';').replace( 436 /([^;])$/, '$1;'); 452 return filterStyles( this.$.style.cssText ); 437 453 } 438 454 439 455 return standard.call( this, name );