-
My name is Brad Harris, and I currently reside in the Abq, New Mexico area. I'm a web-developer, specializing in front-end development. PHP is my weapon of choice for the server side, but my creative side thrives on Javascript and CSS.
- Hoping for a snow day 2010/01/19
- Wrote a new post on "Getting keycode values in Javascript" - http://bit.ly/PIcup 2009/09/16
-
My Recent Ramblings
Categories
Archives
- September 2009 (1)
- January 2009 (3)
- December 2008 (1)
- September 2008 (2)
- August 2008 (2)
- July 2008 (3)
- April 2008 (2)
- March 2008 (2)
- February 2008 (1)
- January 2008 (1)
- November 2007 (1)
- October 2007 (1)
- September 2007 (3)
- August 2007 (1)
- June 2007 (1)
- May 2007 (2)
- April 2007 (1)
- March 2007 (2)
- February 2007 (3)
- January 2007 (1)
yui and cloneNode()
Well, recently I had some problems when using some YUI Panels that included
<select>inputs, and checkbox<input>s. The problem had to do with the fact that yui copies your panel contents using the native cloneNode() javascript function. Similar problems have been seen by others, but I’ve yet to hear a solution or fix provided by the YUI team. The problem doesn’t originate from Yahoo!, rather IE doesn’t copy across selectedIndex values when using the cloneNode(true) function (which copies all inner elements of the element being copied. The solution, set the copied elements values with the original elements values after the cloneNode() function is run. This worked fine, I just made a small function that received 2 parameters, the original and cloned elements, and then went through and grabbed all the<select>, checkboxes, and radio buttons, and copied the original values of selectedIndex/checked/selected, into the cloned elements values. It would be nice if this was taken into account in the yui framework though.After getting that to work, I then noticed that events I had attatched to some checkboxes using YAHOO.util.Event.addListener() weren’t being copied over either. I had to further modify my function to go through and copy events over as well. This wasn’t too difficult with the YAHOO.util.Event.getListeners() function though. Anyone else had similar issues?