| 3769 | | // @todo : probably better to use String.indexOf() instead of this ugly regex |
| 3770 | | // if ((Xinha.is_ie && root.scopeName != 'HTML') || (!Xinha.is_ie && tag.indexOf(':') !== -1)) { |
| 3771 | | if ( ( Xinha.is_ie && root.scopeName != 'HTML' ) || ( !Xinha.is_ie && ( /:/.test(tag) ) ) ) |
| 3772 | | { |
| 3773 | | stripTag(root); |
| 3774 | | return false; |
| 3775 | | } |
| 3776 | | else |
| 3777 | | { |
| 3778 | | clearClass(root); |
| 3779 | | clearStyle(root); |
| 3780 | | for ( i = root.firstChild; i; i = next ) |
| 3781 | | { |
| 3782 | | next = i.nextSibling; |
| 3783 | | if ( i.nodeType == 1 && parseTree(i) ) |
| | 3769 | |
| | 3770 | clearClass(root); |
| | 3771 | clearStyle(root); |
| | 3772 | |
| | 3773 | for (var i = root.firstChild; i; i = next ) |
| | 3774 | { |
| | 3775 | next = i.nextSibling; |
| | 3776 | if ( i.nodeType == 1 && parseTree(i) ) |
| | 3777 | { |
| | 3778 | if ((Xinha.is_ie && root.scopeName != 'HTML') || (!Xinha.is_ie && /:/.test(tag))) |
| 3785 | | if (checkEmpty(i)) |
| | 3780 | // Nowadays, Word spits out tags like '<o:something />'. Since the |
| | 3781 | // document being cleaned might be HTML4 and not XHTML, this tag is |
| | 3782 | // interpreted as '<o:something /="/">'. For HTML tags without |
| | 3783 | // closing elements (e.g. IMG) these two forms are equivalent. Since |
| | 3784 | // HTML does not recognize these tags, however, they end up as |
| | 3785 | // parents of elements that should be their siblings. We reparent |
| | 3786 | // the children and remove them from the document. |
| | 3787 | for (var index=i.children && ichildren.length-1; i.children && i.children.length && i.children[index]; ++index) |
| 3796 | | // 8 is a comment node, and can contain conditional comments. |
| 3797 | | if (/(\s*\[\s*if\s*(([gl]te?|!)\s*)?(IE|mso)\s*(\d+(\.\d+)?\s*)?\]>)/.test(i.nodeValue)) |
| 3798 | | { |
| 3799 | | // We strip all conditional comments directly from the tree. |
| 3800 | | Xinha.removeFromParent(i); |
| 3801 | | ++stats.cond_comm; |
| 3802 | | } |
| | 3802 | continue; |
| | 3803 | } |
| | 3804 | if (removeElements(i)) |
| | 3805 | { |
| | 3806 | continue; |
| | 3807 | } |
| | 3808 | } |
| | 3809 | else if (i.nodeType == 8) |
| | 3810 | { |
| | 3811 | // 8 is a comment node, and can contain conditional comments, which |
| | 3812 | // will be interpreted by IE as if they were not comments. |
| | 3813 | if (/(\s*\[\s*if\s*(([gl]te?|!)\s*)?(IE|mso)\s*(\d+(\.\d+)?\s*)?\]>)/.test(i.nodeValue)) |
| | 3814 | { |
| | 3815 | // We strip all conditional comments directly from the tree. |
| | 3816 | Xinha.removeFromParent(i); |
| | 3817 | ++stats.cond_comm; |