This project is archived and is in readonly mode.

#187 ✓invalid
jmabey

Element.getElementById(<id>) not useful when cloning.

Reported by jmabey | July 2nd, 2008 @ 06:18 PM | in 2.0 (closed)

We are cloning a div with many children to build a list of dynamic elements. When cloning we need to bind anchors and other elements to functions. The current code found in getElementById doesn't allow for use of the id to find the proper child element. It also doesn't recurse through any of the elements to find the desired element.

I would propose the following code as a solution to my issues.

getElementById: function(desiredId, nocash){

for(var i=0; i

if(this.childNodes[i].id && this.childNodes[i].id == desiredId) {

return $.element(this.childNodes[i], nocash);

}

}

for(var i=0; i

var returnValue = this.childNodes[i].getElementById(desiredId, nocash);

if(returnValue) return returnValue;

}

return null;

}

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Pages