This is a migrated thread and some comments may be shown as answers.

ColorPicker js error on "picking" when array.prototype used

1 Answer 45 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Boleslav Malynovsky
Top achievements
Rank 1
Boleslav Malynovsky asked on 20 Apr 2010, 11:55 AM
Hello, Telerik!

I believe you guys read such threads, so I hope this would help you or someone else in the components using/improvements.

I don't know if the bug already fixed or found, but anyway...

I spent some time to get to know why my ColorPicker gives js error when trying to open palette and thanks to IE 8 debugger it didn't take so much time.
So the problem is:

I use the following code on my site:

Array.prototype.exists = function('value'){} to be able easily search items in array and it's pretty convenient approach with prototypes using.
but your ColorPicker initializes with colors as "hash" array like this._items = eval('[{'value', ''},{'title',''}]')
there is for(var i in thsi._items) used when the palette building instead of for(var i = 0; i < this._items.length... (not sure why) 
but since "exists" is a part of the array one of the elements as "var _13 = this._items[i]" becomes the function I've defined. And it fails of course  when _13.value is going to be applied to someHTMLelement.style.background (at least in IE).

So now I have some "pervertions" (like $find('picker')._items["exists"] = {'value', ''},{'title',''}) since use "exists" along the site framework...

The best!

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 22 Apr 2010, 03:16 PM
Hello Boleslav Malynovsky,
I can recall that there was such a problem in one of the previous versions of the color picker. A client of ours reported it to us and we fixed it. I am not quite sure which version of the suite you use, but you should not be able to reproduce the problem with the latest version - 2010.1 415.

All the best,
Tsvetie
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ColorPicker
Asked by
Boleslav Malynovsky
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or