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++) {
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 (e.tagName.indexOf(":") > -1 && typeof(this.tag) == 'object' && this.tag.indexOf(":") > -1)
43 (e.tagName.indexOf(":") > -1 && typeof(this.tag) == 'string' && this.tag == ":")
45 this.replaceTag(ar[i]); // child is blacklisted as well...
50 ar = Array.from(node.childNodes);
51 for (var i = 0; i < ar.length; i++) {
53 node.removeChild(ar[i]);
54 // what if we need to walk these???
55 node.parentNode.insertBefore(ar[i], node);
56 if (this.tag !== false) {
61 node.parentNode.removeChild(node);
62 return false; // don't walk children