Skip to content

Element.down() (without parameters) returns "null" #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
leonardfischer opened this issue Jun 2, 2016 · 2 comments
Closed

Element.down() (without parameters) returns "null" #317

leonardfischer opened this issue Jun 2, 2016 · 2 comments

Comments

@leonardfischer
Copy link

Hi,

I'm experiencing a problem in Prototype 1.7.3 with the .down() method, when called without any parameter.

Given this simple HTML for example:

<div id="test">
   <ul>
      <li>
   </ul>
</div>

And this Javascript:

$('test').down();  // Returns: null
$('test').down(0); // Returns: <ul>

This does break a lot of code (including the Scriptaculous Autocompleter for example)... Is this the desired behaviour?

Best regards,
Leo

@walterdavis
Copy link

On Jun 2, 2016, at 8:08 AM, Leonard Fischer [email protected] wrote:

Hi,

I'm experiencing a problem in Prototype 1.7.3 with the .down() method, when called without any parameter.

Given this simple HTML for example:

And this Javascript:

$('test').down(); // Returns: null
$('test').down(0); // Returns:

    This does break a lot of code (including the Scriptaculous Autocompleter for example)... Is this the desired behaviour?

    Best regards,
    Leo

I can't duplicate that here, using your code in an otherwise blank HTML5 document. You may have something else going on in this page that is causing this to happen for you. Can you post a link to a broken example?

Walter


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@leonardfischer
Copy link
Author

leonardfischer commented Jun 2, 2016

Hi Walter,

thank you very much for the fast response... It seems you are right - I could not reproduce this issue on a blank page. In my installation however I traced the error back to firstDescendant().
It seems that Node.ELEMENT_NODE holds no value (undefined). In older versions Prototype simply used "1" instead of this constant.

I also use quite some other libraries (CKEditor, D3, Scriptaculous, jit, excanvas, ...). Maybe one of these break my code then...

Leo

EDIT
Oh jesus, I found it... Some old code, used to display a tree, defines a global "Node" variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants