Permalink
Browse files

Fix problem with appending multiple string arguments in IE 6. Fixes #…

…9072.
  • Loading branch information...
jeresig committed May 3, 2011
1 parent 3cdffce commit bfad45fe4510db78a38170752ccc9c9efe5f38b6
Showing with 16 additions and 5 deletions.
  1. +4 −4 src/manipulation.js
  2. +12 −1 test/unit/manipulation.js
@@ -582,7 +582,7 @@ jQuery.extend({
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}

var ret = [];
var ret = [], j;

This comment has been minimized.

@mathiasbynens

mathiasbynens May 3, 2011

Contributor

Why not declare i and elem here as well then? They’re all in the same scope.

This comment has been minimized.

@timmywil

timmywil May 3, 2011

Member

No objections here. Think we were more concerned with breaking dom manipulation. ;)


for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
@@ -628,7 +628,7 @@ jQuery.extend({
div.childNodes :
[];

for ( var j = tbody.length - 1; j >= 0 ; --j ) {
for ( j = tbody.length - 1; j >= 0 ; --j ) {
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
@@ -649,8 +649,8 @@ jQuery.extend({
var len;
if ( !jQuery.support.appendChecked ) {
if ( elem[0] && typeof (len = elem.length) === "number" ) {
for ( i = 0; i < len; i++ ) {
findInputs( elem[i] );
for ( j = 0; j < len; j++ ) {
findInputs( elem[j] );
}
} else {
findInputs( elem );
@@ -227,7 +227,7 @@ test("unwrap()", function() {
});

var testAppend = function(valueObj) {
expect(40);
expect(41);
var defaultText = "Try them out:"
var result = jQuery("#first").append(valueObj("<b>buga</b>"));
equals( result.text(), defaultText + "buga", "Check if text appending works" );
@@ -344,6 +344,17 @@ var testAppend = function(valueObj) {
equals( $radio[0].checked, true, "Reappending radios uphold which radio is checked" );
equals( $radioNot[0].checked, false, "Reappending radios uphold not being checked" );
QUnit.reset();

var prev = jQuery("#sap").children().length;

jQuery("#sap").append(
"<span></span>",
"<span></span>",
"<span></span>"
);

equals( jQuery("#sap").children().length, prev + 3, "Make sure that multiple arguments works." );
QUnit.reset();
}

test("append(String|Element|Array&lt;Element&gt;|jQuery)", function() {

0 comments on commit bfad45f

Please sign in to comment.