fix #7922 - span inside span isue with last change
authorAlan <alan@roojs.com>
Mon, 4 Dec 2023 03:36:52 +0000 (11:36 +0800)
committerAlan <alan@roojs.com>
Mon, 4 Dec 2023 03:36:52 +0000 (11:36 +0800)
Roo/htmleditor/Filter.js
roojs-all.js
roojs-bootstrap-debug.js
roojs-bootstrap.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 4603568..e1a89cb 100644 (file)
@@ -88,6 +88,9 @@ Roo.htmleditor.Filter.prototype = {
         var els = dom.getElementsByTagName(this.tag);
 
         Roo.each(Array.from(els), function(e){
+            if(e.parentNode == null) {
+                return;
+            }
             if(this.replaceTag) {
                 this.replaceTag(e);
             }
index 9c448c7..d2b49a3 100644 (file)
@@ -1897,7 +1897,7 @@ Roo.htmleditor={};
 Roo.htmleditor.Filter=function(A){Roo.apply(this.cfg);};Roo.htmleditor.Filter.prototype={node:false,tag:false,replaceComment:false,replaceTag:false,walk:function(A){Roo.each(Array.from(A.childNodes),function(e){switch(true){case e.nodeType==8&&this.replaceComment!==false:this.replaceComment(e);
 return;case e.nodeType!=1:return;case this.tag===true:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='object'&&this.tag.indexOf(":")>-1:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='string'&&this.tag==":":case typeof(this.tag)=='object'&&this.tag.indexOf(e.tagName)>-1:case typeof(this.tag)=='string'&&this.tag==e.tagName:if(this.replaceTag&&false===this.replaceTag(e)){return;
 }if(e.hasChildNodes()){this.walk(e);}return;default:if(e.hasChildNodes()){this.walk(e);}}},this);},removeNodeKeepChildren:function(A){ar=Array.from(A.childNodes);for(var i=0;i<ar.length;i++){A.removeChild(ar[i]);A.parentNode.insertBefore(ar[i],A);}A.parentNode.removeChild(A);
-},searchTag:function(A){if(this.tag===false){return;}var B=A.getElementsByTagName(this.tag);Roo.each(Array.from(B),function(e){if(this.replaceTag){this.replaceTag(e);}},this);}};
+},searchTag:function(A){if(this.tag===false){return;}var B=A.getElementsByTagName(this.tag);Roo.each(Array.from(B),function(e){if(e.parentNode==null){return;}if(this.replaceTag){this.replaceTag(e);}},this);}};
 // Roo/htmleditor/FilterAttributes.js
 Roo.htmleditor.FilterAttributes=function(A){Roo.apply(this,A);this.attrib_black=this.attrib_black||[];this.attrib_white=this.attrib_white||[];this.attrib_clean=this.attrib_clean||[];this.style_white=this.style_white||[];this.style_black=this.style_black||[];
 this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterAttributes,Roo.htmleditor.Filter,{tag:true,attrib_black:false,attrib_clean:false,attrib_white:false,style_white:false,style_black:false,replaceTag:function(A){if(!A.attributes||!A.attributes.length){return true;
index fdf09ce..a6287b8 100644 (file)
@@ -27110,6 +27110,9 @@ Roo.htmleditor.Filter.prototype = {
         var els = dom.getElementsByTagName(this.tag);
 
         Roo.each(Array.from(els), function(e){
+            if(e.parentNode == null) {
+                return;
+            }
             if(this.replaceTag) {
                 this.replaceTag(e);
             }
index 9a6a09f..7c9b1d7 100644 (file)
@@ -1183,7 +1183,7 @@ this.push({type:'endparagraph',pos:this.cpos,row:this.row,col:this.col});}};
 Roo.htmleditor.Filter=function(A){Roo.apply(this.cfg);};Roo.htmleditor.Filter.prototype={node:false,tag:false,replaceComment:false,replaceTag:false,walk:function(A){Roo.each(Array.from(A.childNodes),function(e){switch(true){case e.nodeType==8&&this.replaceComment!==false:this.replaceComment(e);
 return;case e.nodeType!=1:return;case this.tag===true:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='object'&&this.tag.indexOf(":")>-1:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='string'&&this.tag==":":case typeof(this.tag)=='object'&&this.tag.indexOf(e.tagName)>-1:case typeof(this.tag)=='string'&&this.tag==e.tagName:if(this.replaceTag&&false===this.replaceTag(e)){return;
 }if(e.hasChildNodes()){this.walk(e);}return;default:if(e.hasChildNodes()){this.walk(e);}}},this);},removeNodeKeepChildren:function(A){ar=Array.from(A.childNodes);for(var i=0;i<ar.length;i++){A.removeChild(ar[i]);A.parentNode.insertBefore(ar[i],A);}A.parentNode.removeChild(A);
-},searchTag:function(A){if(this.tag===false){return;}var B=A.getElementsByTagName(this.tag);Roo.each(Array.from(B),function(e){if(this.replaceTag){this.replaceTag(e);}},this);}};
+},searchTag:function(A){if(this.tag===false){return;}var B=A.getElementsByTagName(this.tag);Roo.each(Array.from(B),function(e){if(e.parentNode==null){return;}if(this.replaceTag){this.replaceTag(e);}},this);}};
 // Roo/htmleditor/FilterAttributes.js
 Roo.htmleditor.FilterAttributes=function(A){Roo.apply(this,A);this.attrib_black=this.attrib_black||[];this.attrib_white=this.attrib_white||[];this.attrib_clean=this.attrib_clean||[];this.style_white=this.style_white||[];this.style_black=this.style_black||[];
 this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterAttributes,Roo.htmleditor.Filter,{tag:true,attrib_black:false,attrib_clean:false,attrib_white:false,style_white:false,style_black:false,replaceTag:function(A){if(!A.attributes||!A.attributes.length){return true;
index 89fb784..3b51d8a 100644 (file)
@@ -45760,6 +45760,9 @@ Roo.htmleditor.Filter.prototype = {
         var els = dom.getElementsByTagName(this.tag);
 
         Roo.each(Array.from(els), function(e){
+            if(e.parentNode == null) {
+                return;
+            }
             if(this.replaceTag) {
                 this.replaceTag(e);
             }
index 1f894d8..51956f7 100644 (file)
@@ -21258,6 +21258,9 @@ Roo.htmleditor.Filter.prototype = {
         var els = dom.getElementsByTagName(this.tag);
 
         Roo.each(Array.from(els), function(e){
+            if(e.parentNode == null) {
+                return;
+            }
             if(this.replaceTag) {
                 this.replaceTag(e);
             }
index e50f9c6..3e156bc 100644 (file)
@@ -950,7 +950,7 @@ Roo.htmleditor={};
 Roo.htmleditor.Filter=function(A){Roo.apply(this.cfg);};Roo.htmleditor.Filter.prototype={node:false,tag:false,replaceComment:false,replaceTag:false,walk:function(A){Roo.each(Array.from(A.childNodes),function(e){switch(true){case e.nodeType==8&&this.replaceComment!==false:this.replaceComment(e);
 return;case e.nodeType!=1:return;case this.tag===true:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='object'&&this.tag.indexOf(":")>-1:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='string'&&this.tag==":":case typeof(this.tag)=='object'&&this.tag.indexOf(e.tagName)>-1:case typeof(this.tag)=='string'&&this.tag==e.tagName:if(this.replaceTag&&false===this.replaceTag(e)){return;
 }if(e.hasChildNodes()){this.walk(e);}return;default:if(e.hasChildNodes()){this.walk(e);}}},this);},removeNodeKeepChildren:function(A){ar=Array.from(A.childNodes);for(var i=0;i<ar.length;i++){A.removeChild(ar[i]);A.parentNode.insertBefore(ar[i],A);}A.parentNode.removeChild(A);
-},searchTag:function(A){if(this.tag===false){return;}var B=A.getElementsByTagName(this.tag);Roo.each(Array.from(B),function(e){if(this.replaceTag){this.replaceTag(e);}},this);}};
+},searchTag:function(A){if(this.tag===false){return;}var B=A.getElementsByTagName(this.tag);Roo.each(Array.from(B),function(e){if(e.parentNode==null){return;}if(this.replaceTag){this.replaceTag(e);}},this);}};
 // Roo/htmleditor/FilterAttributes.js
 Roo.htmleditor.FilterAttributes=function(A){Roo.apply(this,A);this.attrib_black=this.attrib_black||[];this.attrib_white=this.attrib_white||[];this.attrib_clean=this.attrib_clean||[];this.style_white=this.style_white||[];this.style_black=this.style_black||[];
 this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterAttributes,Roo.htmleditor.Filter,{tag:true,attrib_black:false,attrib_clean:false,attrib_white:false,style_white:false,style_black:false,replaceTag:function(A){if(!A.attributes||!A.attributes.length){return true;