var wrap = // option or optgroup !tags.indexOf(" [ 1, "" ] ||
!tags.indexOf(" [ 1, "" ] ||
tags.match(/^ [ 1, "
", "
" ] ||
!tags.indexOf("
[ 2, "
", "
" ] ||
// matched above (!tags.indexOf("
[ 3, "
", "
" ] ||
!tags.indexOf("
[ 2, "
", "
" ] ||
// IE can't serialize and <script> tags normally <BR> !jQuery.support.htmlSerialize && <BR> [ 1, "div<div>", "" ] || <br><br> [ 0, "", "" ]; <br><br> // Go to html and back, then peel off extra wrappers <BR> div.innerHTML = wrap[1] + elem + wrap[2]; <br><br> // Move to the right depth <BR> while ( wrap[0]-- ) <BR> div = div.lastChild; <BR> <br><br>这段代码是作者用来处理 $(html) 时,有些标签必须要约束的,如<option>必须在<select>之内的。 <BR>可能你也发现了作者还有一个很巧的地方就是 !tags.indexOf("<opt") ,作者很巧很简单的就实现了startWith的功能了,没有一点多余的代码。jquery源代码中还有很多如此精妙的代码,大家可以去学习学习。
</script>
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn