Opened 18 years ago
Closed 17 years ago
#940 closed Bug (invalid)
Array prototype extensions breaks plugin code that uses "for(var i in <Array object>)"
Reported by: | Paul Vrugt | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | FCKeditor 2.4.3 |
Keywords: | Cc: |
Description
Instead of creating a new array object, or expanding the static Array object, the fckeditor messes with the standard array prototype. This results in the following problem:
suppose i do this in a plugin:
var objArray = new Array();
objArray['key1'] = 'value1';
objArray['key2'] = 'value2';
for(var strKey in objArray)
alert(objArray[strKey]);
i wanted to get all values from the array, but instead, i get all values + 2 function objects, since the fckEditor added AddItem and IndexOf to the array prototype.
Change History (1)
comment:1 Changed 17 years ago by
Keywords: | Array Prototype IndexOf AddItem removed |
---|---|
Resolution: | → invalid |
Status: | new → closed |
You are wrongly using an array in your sample. You should use and Object instead:
In this case you will not have problems.
In any case, it is already part of our plans to avoid touching native objects.