2 * @class Roo.htmleditor.FilterKeepChildren
3 * remove tags but keep children
5 * Run a new Keep Children Filter
6 * @param {Object} config Configuration options
9 Roo.htmleditor.FilterKeepChildren = function(cfg)
12 if (this.tag === false) {
13 return; // dont walk.. (you can use this to use this just to do a child removal on a single tag )
18 Roo.extend(Roo.htmleditor.FilterKeepChildren, Roo.htmleditor.FilterBlack,
22 replaceTag : function(node)
26 var ar = Array.from(node.childNodes);
28 for (var i = 0; i < ar.length; i++) {
29 if (ar[i].nodeType == 1) {
31 (typeof(this.tag) == 'object' && this.tag.indexOf(ar[i].tagName) > -1)
32 || // array and it matches
33 (typeof(this.tag) == 'string' && this.tag == ar[i].tagName)
35 this.replaceTag(ar[i]); // child is blacklisted as well...
40 ar = Array.from(node.childNodes);
41 for (var i = 0; i < ar.length; i++) {
43 node.removeChild(ar[i]);
44 // what if we need to walk these???
45 node.parentNode.insertBefore(ar[i], node);
46 if (this.tag !== false) {
51 node.parentNode.removeChild(node);
52 return false; // don't walk children