This project is archived and is in readonly mode.

#203 ✓resolved

Slick nodes with no parents

Reported by David | July 7th, 2008 @ 11:17 PM | in 1.3.0 rc2 (closed)

This appears to be by design.

Element.getElementById calls this.ownerDocument.getElementById to find elements... but what if I'm trying to find an element in an object not in the document (say something returned from AJAX)? It doesn't work.

Element.getElement doesn't work either, because it calls Element.getElementById. Element.getElement at least used to work in this case in Mootools 1.1.

In my mind at least this is a big usability bug.

Comments and changes to this ticket

  • Jan Kassens

    Jan Kassens July 14th, 2008 @ 12:33 AM

    • State changed from “new” to “hold”
    • Tag changed from defect to defect, regression

    i think it didnt work in the old version in IE.

    i'm not sure if this one should be patched because of speed reasons. could be useful for ajax results though.

  • David

    David July 14th, 2008 @ 08:30 AM

    Maybe there could be a different method for doing this if the element isn't in the document? That way speed could be preserved for the "typical" use of searching for elements in document.

  • MikeC

    MikeC November 12th, 2008 @ 06:23 PM

    I was bitten by this too as I was trying to mess around with an html ajax response. The workaround I am using is to put the ajax response into a hidden div in the document, and ask the document for the element by id.

  • Thomas Aylott

    Thomas Aylott March 17th, 2009 @ 01:26 AM

    • Tag changed from defect, regression to defect, regression, selectors, slick
    • State changed from “hold” to “open”
    • Title changed from “Element.getElementById doesn't work for elements not in document” to “Slick nodes with no parents”

    not sure if this currently works in slick or not, but it should.

    I should add some specs to test for this.

  • Jan Kassens

    Jan Kassens November 21st, 2009 @ 03:06 PM

    • Assigned user changed from “Valerio” to “Thomas Aylott”

    Are there specs for this now with the mocks?

  • Fábio M. Costa

    Fábio M. Costa April 1st, 2010 @ 06:18 PM

    • State changed from “open” to “resolved”
    • Milestone changed from 2.0 to 1.3.0 rc2

    There are specs for this. And they are passing.

Create your profile

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

Shared Ticket Bins