Ticket #689 (new defect)
Opened 4 years ago
Map function in MgtdAppFramework overrides tiddly wiki map function for Arrays
| Reported by: | deterb | Owned by: | SimonBaird |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | MonkeyGTD | Version: | |
| Severity: | medium | Keywords: | |
| Cc: |
Description
Based on a note in the code which I checked, the map function merged into the Array prototype overwrites the map function which tiddlywiki puts there.
Our version:
map: function(func) {
var result = [];
this.each(function(item) {
result.push(func(item));
});
return result;
}
Their version
if(!Array.prototype.map) {
Array.prototype.map = function(fn,thisObj)
{
var scope = thisObj || window;
var a = [];
for(var i=0, j=this.length; i < j; ++i) {
a.push(fn.call(scope,this[i],i,this));
}
return a;
};}
It looks like the main difference is that they have a version which is designed for running methods on objects.
Their version doesn't look like it's used in the source code. Our version is used in the MgtdIndexedTags.js.
My recommendation would be to rename our map to map1 or some other name,
Note: See
TracTickets for help on using
tickets.
