Opened 10 years ago
Closed 10 years ago
#13742 closed bug (notabug)
jQuery.parseHTML() - "context" argument not working
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The following scenario not working:
<form id="main"> </form> <script> var elems = jQuery.parseHTML("<input>", document.getElementById("main")); $("#main").append(elems); </script>
Error is thrown because the function createElement() is called on "Node" object (not "document"). In case of more complex HTML function createDocumentFragment() on "Node" object is called. In short, expected only "document" object.
What does the argument "context"? In what scenario it can be useful? As I understand the documentation, result should be added to the "context" after method call in any case.
Note: See
TracTickets for help on using
tickets.
Ported to docs issue: https://github.com/jquery/api.jquery.com/issues/281