Changeset 219

Show
Ignore:
Timestamp:
2007-03-17 11:07:44 (3 years ago)
Author:
fredck
Message:

Fixed #257 : The new tag protections for HR were broken on cases of <hr> without the self-closing slash (<hr />).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/_source/internals/fck.js

    r217 r219  
    290290        ProtectTags : function( html ) 
    291291        { 
    292                 // <meta> tags get executed, so if you have a redirect meta, the content 
    293                 // will move to the target page. 
    294                 var sTags = 'META' ; 
    295  
    296                 if ( FCKConfig.ProtectedTags.length > 0 ) 
    297                         sTags += '|' + FCKConfig.ProtectedTags ; 
     292                var sTags = FCKConfig.ProtectedTags ; 
    298293 
    299294                // IE doesn't support <abbr> and it breaks it. Let's protect it. 
    300295                if ( FCKBrowserInfo.IsIE ) 
    301                         sTags += '|ABBR|HR' ; 
    302  
    303                 var oRegex = new RegExp( '<(' + sTags + ')(?!\w|:)', 'gi' ) ; 
    304                 html = html.replace( oRegex, '<FCK:$1' ) ; 
    305  
    306                 oRegex = new RegExp( '<\/(' + sTags + ')>', 'gi' ) ; 
    307                 html = html.replace( oRegex, '<\/FCK:$1>' ) ; 
     296                        sTags += sTags.length > 0 ? '|ABBR' : 'ABBR' ; 
     297                 
     298                var oRegex ; 
     299                if ( sTags.length > 0 ) 
     300                { 
     301                        oRegex = new RegExp( '<(' + sTags + ')(?!\w|:)', 'gi' ) ; 
     302                        html = html.replace( oRegex, '<FCK:$1' ) ; 
     303 
     304                        oRegex = new RegExp( '<\/(' + sTags + ')>', 'gi' ) ; 
     305                        html = html.replace( oRegex, '<\/FCK:$1>' ) ; 
     306                } 
     307                 
     308                // Protect some empty elements. We must do it separately becase the 
     309                // original tag may not contain the closing slash, like <hr>: 
     310                //              - <meta> tags get executed, so if you have a redirect meta, the 
     311                //                content will move to the target page. 
     312                //              - <hr> may destroy the document structure if not well 
     313                //                positioned. The trick is protect it here and restore them in 
     314                //                the FCKDocumentProcessor. 
     315                sTags = 'META' ; 
     316                if ( FCKBrowserInfo.IsIE ) 
     317                        sTags += '|HR' ; 
     318 
     319                oRegex = new RegExp( '<((' + sTags + ')(?=\s|>)[\s\S]*?)/?>', 'gi' ) ; 
     320                html = html.replace( oRegex, '<FCK:$1 />' ) ; 
    308321 
    309322                return html ;