Side navigation
#9647 closed bug (duplicate)
Opened June 22, 2011 07:25PM UTC
Closed June 22, 2011 07:44PM UTC
Last modified June 22, 2011 08:30PM UTC
.append() fails when jQuery object in array
Reported by: | jquery@paulkoppen.com | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | manipulation | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
1. The version(s) of jQuery affected
tested: 1.0, 1.3, 1.6.1
(all minified, 1.0 packed)
2. The browser (or browsers) that you are able to reproduce the bug in, including version numbers
Firefox 4.0.1
Chrome 12.0
3. The operating system (or operating systems) you experienced the bug on.
Windows 7
4. Step-by-step instructions on how to reproduce the issue, including any required system configuration changes
Following script.
jQuery(function(){ var $ = jQuery; // for jQuery 1.0 // OK: $('body').append($('<p>'),$('<p>')); // OK: $('body').append([document.createElement('p'),document.createElement('p')]); // ERROR: $('body').append([$('<p>'),$('<p>')]); });
5. A description of what you expect to happen, and what actually happens
For visualisation I added a border to paragraph tags in the CSS. Because they are empty tags this renders as a line (when successful). I would expect 6 such lines; each statement renders two.
I get four lines, so the last statement fails. Firefox (Firebug) says: NS_ERROR_XPC_BAD_CONVERT_JS. Chrome says: NOT_FOUND_ERR DOM Exception 8.
6. A link to a reduced, working demo/test case that will never move (jsFiddle is good for this)
7. Information on other jQuery versions tested, including whether or not the issue is reproducible there
Reproducible on all versions tested: 1.0, 1.3, 1.6 (jsFiddle), 1.6.1
Versions (except jsFiddle) were minified/packed versions.
8. Information on other browsers where the issue does not occur
Only tested Firefox and Chrome. Suspect IE and Opera will not make a difference.
9. References to the URL of a web server mentioned in your ticket (if any) in the case of a bug involving Ajax or server-side requests which are needed to fully evaluate the issue experienced.
not present
10. A patch (preferably as a link to a GitHub commit or pull request)
sorry, not my expertise
11. A link to any relevant discussions, such as forum posts.
not available
Attachments (0)
Change History (4)
Changed June 22, 2011 07:42PM UTC by comment:1
component: | unfiled → manipulation |
---|---|
priority: | undecided → low |
Changed June 22, 2011 07:44PM UTC by comment:2
resolution: | → duplicate |
---|---|
status: | new → closed |
Changed June 22, 2011 08:30PM UTC by comment:4
That is responsive.
I searched for this "bug" but could not easily find a duplicate. As in the original case, I too bumped into this by using $.map(). The discussion in the original ticket is adequate and very helpful. Thanks.
I don't think that signature is supported. If in an array, they should be nodes.
Internally, this is because the clean function loops through the object and instead of having to loop through each individual jQuery object (e.g. [ $(node, node), $(node, anotherNode) ]), it will assume each spot in the array is a node. This means you can you use just a jquery object (e.g. $(node, node) ) or a simple array of nodes (e.g. [ node, node ]). Supporting arrays of jQuery objects is more complex and I think more than is needed.