Opened 15 years ago
Closed 15 years ago
#4825 closed defect (fixed)
NodeList.adopt does not work when it is passed a NodeList as an argument
Reported by: | ptwobrussell | Owned by: | alex |
---|---|---|---|
Priority: | high | Milestone: | 1.0 |
Component: | Core | Version: | 1.0 |
Keywords: | Cc: | [email protected]… | |
Blocked By: | Blocking: |
Description (last modified by )
/* Works */ n = document.createElement("DIV"); n.innerHTML="foobar"; dojo.query("#_div1").adopt(n); /* Doesn't Work */ n = document.createElement("DIV"); n.innerHTML="foobar"; nl = new dojo.NodeList(n); dojo.query("#_div1").adopt([n]);
The reason that the latter doesn't work is because the dojo.query call inside of NodeList?.adopt is creating a nested NodeList?, which is getting iterated over in the forEach call. Simple fix is to either index [0] into the dojo.query call or otherwise "fix" dojo.query to act like a no-op when it is passed a NodeList?.
Change History (2)
comment:1 Changed 15 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
(In [11045]) ensure that dojo.query passes back a node list if it's inadvertently passed in. Fixes #4825