This project is archived and is in readonly mode.

#745 ✓resolved
daKmoR

getElements('#myId') and getElementById('myId') only works after injected into the DOM

Reported by daKmoR | September 13th, 2009 @ 12:32 PM | in 1.3.0 rc2 (closed)


var tmp = new Element('div', { html: '<div><h3>header</h3><p>some text</p><h3 id="special">special header</h3></div>' });
console.log( tmp.getElements('h3') ); // [h3, h3#special]
console.log( tmp.getElements('h3#special') ); // []
console.log( tmp.getElementById('special') ); // null


$(document.body).grab( tmp );
console.log( tmp.getElements('h3') ); // [h3, h3#special]
console.log( tmp.getElements('h3#special') ); // [h3#special]
console.log( tmp.getElementById('special') ); // <h3 id="special">

MooShell: http://mooshell.net/pNJvd/

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

Pages