Ticket #3693: 3693.patch

File 3693.patch, 1.7 KB (added by Tobiasz Cudnik, 15 years ago)
  • _source/core/dom/element.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
     
    397397                {
    398398                        var standard = function( name )
    399399                        {
    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 );
    401404                        };
    402405
     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
    403422                        if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )
    404423                        {
    405424                                return function( name )
     
    430449
    431450                                                case 'style':
    432451                                                        // 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 );
    437453                                        }
    438454
    439455                                        return standard.call( this, name );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy