Ticket #3576: 3576_2.patch

File 3576_2.patch, 1.8 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/styles/plugin.js

     
    867867        function removeFromElement( style, element )
    868868        {
    869869                var def = style._.definition,
    870                         attributes = def.attributes,
     870                        attributes = CKEDITOR.tools.extend( {}, def.attributes, getOverrides( style )[ element.getName() ] ),
    871871                        styles = def.styles,
    872                         overrides = getOverrides( style );
     872                        // If the style is only about the element itself, we have to remove the element.
     873                        removeEmpty = CKEDITOR.tools.isEmpty( attributes ) && CKEDITOR.tools.isEmpty( styles );
    873874
    874                 function removeAttrs()
    875                 {
    876                         for ( var attName in attributes )
    877                         {
    878                                 // The 'class' element value must match (#1318).
    879                                 if ( attName == 'class' && element.getAttribute( attName ) != attributes[ attName ] )
    880                                         continue;
    881                                 element.removeAttribute( attName );
    882                         }
    883                 }
     875                // Remove definition attributes/style from the elemnt.
     876                for ( var attName in attributes )
     877                {
     878                        // The 'class' element value must match (#1318).
     879                        if ( attName == 'class' && element.getAttribute( attName ) != attributes[ attName ] )
     880                                continue;
     881                        element.removeAttribute( attName );
     882                        removeEmpty = true;
     883                }
    884884
    885                 // Remove definition attributes/style from the elemnt.
    886                 removeAttrs();
    887885                for ( var styleName in styles )
     886                {
    888887                        element.removeStyle( styleName );
     888                        removeEmpty = true;
     889                }
    889890
    890                 // Now remove override styles on the element.
    891                 attributes = overrides[ element.getName() ];
    892                 if ( attributes )
    893                         removeAttrs();
    894                 removeNoAttribsElement( element );
     891                removeEmpty && removeNoAttribsElement( element );
    895892        }
    896893
    897894        // Removes a style from inside an element.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy