javascript - jQuery note in Section 5.2.2 of W3C DOM4 Specification -


is there can explain note on section 5.2.2 of w3c dom4 specification?

relevant quote:

note: getelementbyid() method not on elements compatibility older versions of jquery. if time comes version of jquery has disappeared, might able support it.

i'm curious how interface explicitly cause problem jquery , versions, have example?

to expand on @nan answer, has jquery using getelementbyid validate step in iteration. adding method htmlelement make conditions validate when part of jquery code depends on not validating.

hard version causes problem , in situations, quick old jquery versions, can see find() in older version isn't compatible elements having getelementbyid method.

going version 1.3, can try add method htmlelement , you'll see messes result. more recent version handle correctly. see snippet:

alert('without getelementbyid method on htmlelement, length of $("div").find("#test") ' + $('div').find('#test').length);  window.htmlelement.prototype.getelementbyid = function(str){      console.log(str);      return str;  }    alert('with getelementbyid method on htmlelement, length of $("div").find("#test") ' + $('div').find('#test').length);
<script src="https://code.jquery.com/jquery-1.3.js"></script>  <div id="container"><div id="test"></div></div>


Comments