jQuery.clean使用方法及思路分析

2020-05-23 06:24:37易采站长站整理

                             // String was a bare <thead> or <tfoot>
                             // 如果字符串中仅有一个空thead或tfoot标签
                             // 变量tbody为div.childNodes(字符串中的thead和tfoot标签集合)
                             wrap[1] === “<table>” && !hasBody ?
                                 div.childNodes :
                                 [];
                         for ( j = tbody.length – 1; j >= 0 ; –j ) {
                             // 排除thead或tfoot标签
                             if ( jQuery.nodeName( tbody[ j ], “tbody” ) && !tbody[ j ].childNodes.length ) {
                                 // 清除空table标签中自动加入的tbody
                                 tbody[ j ].parentNode.removeChild( tbody[ j ] );
                             }
                         }
                     }
                     // IE completely kills leading whitespace when innerHTML is used