prototypejs / prototype

Prototype JavaScript framework
http://prototypejs.org/
Other
3.54k stars 639 forks source link

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

Closed leonardfischer closed 8 years ago

leonardfischer commented 8 years ago

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 commented 8 years ago

On Jun 2, 2016, at 8:08 AM, Leonard Fischer notifications@github.com 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 commented 8 years ago

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.