jQuery's .end() doesn't work as expected after .contents()?
问题 a = $("table").clone().find("p:has(input)").contents().not("span:has(input:checked)").remove().end().text() b = $("table").clone().find("p:has(input)").contents().not("span:has(input:checked)").text() c = $("table").clone().find("p:has(input)").contents().not("span:has(input:checked)").empty().end().text() d = $("table").clone().text() $("#a").text(a) $("#b").text(b) $("#c").text(c) $("#d").text(d) <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>