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 )
16 if ((typeof(this.tag) == 'object' && this.tag.indexOf(":") > -1)) {
17 this.cleanNamespace = true;
23 Roo.extend(Roo.htmleditor.FilterKeepChildren, Roo.htmleditor.FilterBlack,
25 cleanNamespace : false, // should really be an option, rather than using ':' inside of this tag.
27 replaceTag : function(node)
31 var ar = Array.from(node.childNodes);
34 for (var i = 0; i < ar.length; i++) {
35 if (ar[i].nodeType == 1) {
37 (typeof(this.tag) == 'object' && this.tag.indexOf(ar[i].tagName) > -1)
38 || // array and it matches
39 (typeof(this.tag) == 'string' && this.tag == ar[i].tagName)
41 this.cleanNameSpace && ar[i].tagName.match(/:/)
43 this.replaceTag(ar[i]); // child is blacklisted as well...
48 ar = Array.from(node.childNodes);
49 for (var i = 0; i < ar.length; i++) {
51 node.removeChild(ar[i]);
52 // what if we need to walk these???
53 node.parentNode.insertBefore(ar[i], node);
54 if (this.tag !== false) {
59 node.parentNode.removeChild(node);
60 return false; // don't walk children