X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Fhtmlparser%2Felement.js;h=84a452ef922348d2460c4308aed7afeade9c486f;hb=4e90e78dc97789709ee7404359a5517540c27553;hp=2e9a9c3f95282f7ef7904458eeb085e8556f4ccc;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6;p=ckeditor.git diff --git a/_source/core/htmlparser/element.js b/_source/core/htmlparser/element.js index 2e9a9c3..84a452e 100644 --- a/_source/core/htmlparser/element.js +++ b/_source/core/htmlparser/element.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -34,11 +34,20 @@ CKEDITOR.htmlParser.element = function( name, attributes ) */ this.children = []; - var tagName = attributes._cke_real_element_type || name; + var tagName = attributes[ 'data-cke-real-element-type' ] || name || ''; + + // Reveal the real semantic of our internal custom tag name (#6639). + var internalTag = tagName.match( /^cke:(.*)/ ); + internalTag && ( tagName = internalTag[ 1 ] ); var dtd = CKEDITOR.dtd, - isBlockLike = !!( dtd.$nonBodyContent[ tagName ] || dtd.$block[ tagName ] || dtd.$listItem[ tagName ] || dtd.$tableContent[ tagName ] || dtd.$nonEditable[ tagName ] || tagName == 'br' ), - isEmpty = !!dtd.$empty[ name ]; + isBlockLike = !!( dtd.$nonBodyContent[ tagName ] + || dtd.$block[ tagName ] + || dtd.$listItem[ tagName ] + || dtd.$tableContent[ tagName ] + || dtd.$nonEditable[ tagName ] + || tagName == 'br' ), + isEmpty = !!dtd.$empty[ name ]; this.isEmpty = isEmpty; this.isUnknown = !dtd[ name ]; @@ -114,11 +123,11 @@ CKEDITOR.htmlParser.element = function( name, attributes ) */ element.filterChildren = function() { - if( !isChildrenFiltered ) + if ( !isChildrenFiltered ) { var writer = new CKEDITOR.htmlParser.basicWriter(); CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.call( element, writer, filter ); - element.children = new CKEDITOR.htmlParser.fragment.fromHtml( writer.getHtml() ).children; + element.children = new CKEDITOR.htmlParser.fragment.fromHtml( writer.getHtml(), 0, element.clone() ).children; isChildrenFiltered = 1; } }; @@ -171,13 +180,13 @@ CKEDITOR.htmlParser.element = function( name, attributes ) var attribsArray = []; // Iterate over the attributes twice since filters may alter // other attributes. - for( var i = 0 ; i < 2; i++ ) + for ( var i = 0 ; i < 2; i++ ) { for ( a in attributes ) { newAttrName = a; value = attributes[ a ]; - if( i == 1 ) + if ( i == 1 ) attribsArray.push( [ a, value ] ); else if ( filter ) { @@ -188,7 +197,7 @@ CKEDITOR.htmlParser.element = function( name, attributes ) delete attributes[ a ]; break; } - else if( newAttrName != a ) + else if ( newAttrName != a ) { delete attributes[ a ]; a = newAttrName; @@ -197,9 +206,9 @@ CKEDITOR.htmlParser.element = function( name, attributes ) else break; } - if( newAttrName ) + if ( newAttrName ) { - if( ( value = filter.onAttribute( element, newAttrName, value ) ) === false ) + if ( ( value = filter.onAttribute( element, newAttrName, value ) ) === false ) delete attributes[ newAttrName ]; else attributes [ newAttrName ] = value;