Changeset 1053
- Timestamp:
- 10/03/08 16:25:33 (2 years ago)
- Files:
-
- 1 modified
-
trunk/XinhaCore.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/XinhaCore.js
r1052 r1053 3640 3640 { 3641 3641 empty_tags : 0, 3642 cond_comm : 0, 3643 mso_elmts : 0, 3642 3644 mso_class : 0, 3643 3645 mso_style : 0, … … 3649 3651 { 3650 3652 empty_tags : "Empty tags removed: ", 3653 cond_comm : "Conditional comments removed", 3654 mso_elmts : "MSO invalid elements removed", 3651 3655 mso_class : "MSO class names removed: ", 3652 3656 mso_style : "MSO inline style removed: ", … … 3718 3722 } 3719 3723 3724 function removeElements(el) 3725 { 3726 if ((('link' == el.tagName.toLowerCase()) && 3727 (el.attributes && /File-List|Edit-Time-Data|themeData|colorSchemeMapping/.test(el.attributes['rel'].nodeValue))) || 3728 (/^(style|meta)$/i.test(el.tagName))) 3729 { 3730 Xinha.removeFromParent(el); 3731 ++stats.mso_elmts; 3732 return true; 3733 } 3734 return false; 3735 } 3736 3720 3737 function checkEmpty(el) 3721 3738 { … … 3726 3743 Xinha.removeFromParent(el); 3727 3744 ++stats.empty_tags; 3728 } 3745 return true; 3746 } 3747 return false; 3729 3748 } 3730 3749 … … 3748 3767 if ( i.nodeType == 1 && parseTree(i) ) 3749 3768 { 3750 checkEmpty(i); 3769 if (checkEmpty(i)) 3770 { 3771 continue; 3772 } 3773 if (removeElements(i)) 3774 { 3775 continue; 3776 } 3777 } 3778 else if (i.nodeType == 8) 3779 { 3780 // 8 is a comment node, and can contain conditional comments. 3781 if (/(\s*\[\s*if\s*(([gl]te?|!)\s*)?(IE|mso)\s*(\d+(\.\d+)?\s*)?\]>)/.test(i.nodeValue)) 3782 { 3783 // We strip all conditional comments directly from the tree. 3784 Xinha.removeFromParent(i); 3785 ++stats.cond_comm; 3786 } 3751 3787 } 3752 3788 }
