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

Prototype compatibility

3 Answers 90 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Luigi Gaeta
Top achievements
Rank 1
Luigi Gaeta asked on 09 Dec 2008, 01:06 PM
Hi guys,
I'm testing the RadColorPicker in my project and I find a compatibility trouble with prototype.js library.
Following an example to reproduce the error. If you remove the line <script type="text/javascript" src=".... prototype.js"></script> everything goes fine.


<%

@ Page Language="C#" AutoEventWireup="true" CodeFile="ProvaColorPicker.aspx.cs" Inherits="Prove_ProvaColorPicker" %>

 

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

<!

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<

 

html xmlns="http://www.w3.org/1999/xhtml" >

 

<

 

head runat="server">

 

 

 

<title>Test ColorPicker</title>

 

 

 

<script type="text/javascript">

 

 

 

function colorChange(sender, eventArgs)

 

{

 

 

var myDiv = document.getElementById("myDiv");

 

myDiv.innerHTML =

 

'Color changed from ' + eventArgs.get_oldColor()

 

+

 

" to " + sender.get_selectedColor();

 

 

 

return;

 

}

 

 

</script>

 

</

 

head>

 

<

 

body>

 

 

 

<form id="form1" runat="server">

 

 

 

<asp:ScriptManager ID="ScriptManager1" runat="server">

 

 

 

</asp:ScriptManager>

 

 

 

<script type="text/javascript" src="../Library/scriptaculous/scriptaculous-js-1.8.2/lib/prototype.js" ></script>

 

 

 

<div>

 

 

 

<telerik:RadColorPicker ID="RadColorPicker1" runat="server" Columns="16" Preset="web216"

 

OnClientColorChange

 

="colorChange" ShowIcon="true">

 

 

 

</telerik:RadColorPicker>

 

 

 

<div id="myDiv"></div>

 

 

 

</div>

 

 

 

</form>

 

</

 

body>

 

</

 

html>

 

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 09 Dec 2008, 03:52 PM
Hi Luigi,

This problem will be fixed in SP2. In short, the reason for the problem itself is that the Array object is enhanced with some properties in prototype.js. This alone changes the way the "for ... in" loop acts on an array. By default the "for...in" statement is used to loop (iterate) through the elements of an array or through the properties of an object. 
 
You can test how the prototype.js modifies the behavior of that loop with the following code - test it with and without the script reference:
<head runat="server">  
    <title>Untitled Page</title> 
    <script type="text/javascript" src="prototype-1.6.0.3.js"></script> 
</head> 
<body> 
    <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
          
        <button onclick="TestForInLoop(); return false;">Test for...in loop</button> 
          
        <script type="text/javascript">  
        function TestForInLoop()  
        {  
            var testArray = [];  
            testArray[0] = "first";  
            testArray[1] = "second";  
            testArray[2] = "third";  
              
            for(var item in testArray)  
            {  
                alert(item);  
            }  
        }  
          
        </script> 
    </form>      
</body> 





All the best,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Luigi Gaeta
Top achievements
Rank 1
answered on 09 Dec 2008, 04:05 PM

Thanks for your reply,
yes I've seen the issue.
When you think to release the SP2?

 

0
Georgi Tunev
Telerik team
answered on 10 Dec 2008, 09:55 AM
Hello Luigi,

Currently there is no fixed date for it, but it should appear in the beginning of the next month.


All the best,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ColorPicker
Asked by
Luigi Gaeta
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Luigi Gaeta
Top achievements
Rank 1
Share this question
or