robnyman / domassistant

Automatically exported from code.google.com/p/domassistant
1 stars 0 forks source link

[PATCH] HTMLArray map doesn't return HTMLArray type object #31

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Index: DOMAssistantComplete.js
===================================================================
--- DOMAssistantComplete.js (revision 555)
+++ DOMAssistantComplete.js (working copy)
@@ -125,10 +125,10 @@
                    return -1;
                };
                H.map = function (fn, context) {
-                   var res = [];
+                   var res = new HTMLArray();
                    for (var i=0, il=this.length; i<il; i++) {
                        if (i in this) {
-                           res[i] = fn.call(context || this[i], this[i], i, this);
+                           res.push(fn.call(context || this[i], this[i], i, this));
                        }
                    }
                    return res;
Index: modules/DOMAssistant.js
===================================================================
--- modules/DOMAssistant.js (revision 555)
+++ modules/DOMAssistant.js (working copy)
@@ -125,10 +125,10 @@
                    return -1;
                };
                H.map = function (fn, context) {
-                   var res = [];
+                   var res = new HTMLArray();
                    for (var i=0, il=this.length; i<il; i++) {
                        if (i in this) {
-                           res[i] = fn.call(context || this[i], this[i], i, this);
+                           res.push(fn.call(context || this[i], this[i], i, this));
                        }
                    }
                    return res;

Original issue reported on code.google.com by wormbo...@gmail.com on 1 Mar 2011 at 2:41

Attachments: