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)
30 //Roo.log(node.tagName);
31 var ar = Array.from(node.childNodes);
34 for (var i = 0; i < ar.length; i++) {
36 if (e.nodeType == 1) {
38 (typeof(this.tag) == 'object' && this.tag.indexOf(e.tagName) > -1)
39 || // array and it matches
40 (typeof(this.tag) == 'string' && this.tag == e.tagName)
42 (e.tagName.indexOf(":") > -1 && typeof(this.tag) == 'object' && this.tag.indexOf(":") > -1)
44 (e.tagName.indexOf(":") > -1 && typeof(this.tag) == 'string' && this.tag == ":")
46 this.replaceTag(ar[i]); // child is blacklisted as well...
51 ar = Array.from(node.childNodes);
52 for (var i = 0; i < ar.length; i++) {
54 node.removeChild(ar[i]);
55 // what if we need to walk these???
56 node.parentNode.insertBefore(ar[i], node);
57 if (this.tag !== false) {
62 //Roo.log("REMOVE:" + node.tagName);
63 node.parentNode.removeChild(node);
64 return false; // don't walk children