Side navigation
Ticket #1143: uniquebug.patch
File uniquebug.patch, 1.4 KB (added by vmx, May 24, 2007 04:17PM UTC)
Patch for 1.1.3a
--- jquery-1.1.3a.js 2007-05-24 17:51:09.000000000 +0200
+++ jquery-1.1.3a_fix1143.js 2007-05-24 17:57:16.000000000 +0200
@@ -1666,28 +1666,28 @@ jQuery.extend({
* @param Array second The second array to merge into the first, unaltered.
* @cat JavaScript
*/
- merge: function(first, second) {
+ merge: function(first, second, unique) {
// We have to loop this way because IE & Opera overwrite the length
// expando of getElementsByTagName
- for ( var i = 0; second[i]; i++ )
+ for ( var i = 0; second[i]; i++ ) {
+ if ( unique ) second[i].$merge = true;
first.push(second[i]);
+ }
return first;
},
unique: function(first) {
- var r = [], num = jQuery.mergeNum++;
+ var r = [];
for ( var i = 0, fl = first.length; i < fl; i++ )
- if ( num != first[i].mergeNum ) {
- first[i].mergeNum = num;
+ if ( first[i].$merge ) {
+ first[i].removeAttribute("$merge");
r.push(first[i]);
}
return r;
},
- mergeNum: 0,
-
/**
* Filter items out of an array, by using a filter function.
*
@@ -2578,7 +2578,7 @@ jQuery.extend({
if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
tag = "param";
- r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
+ r = jQuery.merge( r, ret[i].getElementsByTagName( tag ), true);
}
// It's faster to filter by class and be done with it
Download in other formats:
Original Format
File uniquebug.patch, 1.4 KB (added by vmx, May 24, 2007 04:17PM UTC)
Patch for 1.1.3a
--- jquery-1.1.3a.js 2007-05-24 17:51:09.000000000 +0200
+++ jquery-1.1.3a_fix1143.js 2007-05-24 17:57:16.000000000 +0200
@@ -1666,28 +1666,28 @@ jQuery.extend({
* @param Array second The second array to merge into the first, unaltered.
* @cat JavaScript
*/
- merge: function(first, second) {
+ merge: function(first, second, unique) {
// We have to loop this way because IE & Opera overwrite the length
// expando of getElementsByTagName
- for ( var i = 0; second[i]; i++ )
+ for ( var i = 0; second[i]; i++ ) {
+ if ( unique ) second[i].$merge = true;
first.push(second[i]);
+ }
return first;
},
unique: function(first) {
- var r = [], num = jQuery.mergeNum++;
+ var r = [];
for ( var i = 0, fl = first.length; i < fl; i++ )
- if ( num != first[i].mergeNum ) {
- first[i].mergeNum = num;
+ if ( first[i].$merge ) {
+ first[i].removeAttribute("$merge");
r.push(first[i]);
}
return r;
},
- mergeNum: 0,
-
/**
* Filter items out of an array, by using a filter function.
*
@@ -2578,7 +2578,7 @@ jQuery.extend({
if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
tag = "param";
- r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
+ r = jQuery.merge( r, ret[i].getElementsByTagName( tag ), true);
}
// It's faster to filter by class and be done with it