Hi All,

I found what appears to be a bug in Selector.findChildElements. I'm using
prototype 1.6.0.2 and this behavior was not present in version 1.6.0. I've
experienced this behavior on both IE 7 and FF 2 (didn't test other browsers).

Calling element.descendants() on an input element will call element.select('*')
which in turn calls Selector.findChildElements(element, '*'). This function
returns "undefined" for inputs, but returns an iterable object for other empty
tags such as "hr" and "br", which is very odd (it should either return always
undefined or always return an iterable -empty- object, shouldn't it?).

I didn't go deeper into details about why and where the "bug" exactly is, but I
have this sample code as a proof of concept:

        <form action="whatever.php" method="post"
enctype="application/x-www-form-urlencoded">
                <hr id="test-hr" />
                <input id="test-input" type="text" value="whatever" />
                <br id="test-br" />
        </form>
        
        <script language="javascript" type="text/javascript">
        //<![CDATA[
                document.observe('dom:loaded', function() {
                        // Test HR
                        var hrTest = $('test-hr')
                        var hrDesc = hrTest.descendants();
                        alert(typeof hrDesc);
                        alert(hrDesc.each);
                        // Test Input
                        var inputTest = $('test-input');
                        var inputDesc = inputTest.descendants();
                        alert(typeof inputDesc);
                        // alert(inputDesc.each); // Uncomment and you get a JS
error
                        // Test BR
                        var brTest = $('test-br')
                        var brDesc = brTest.descendants();
                        alert(typeof brDesc);
                        alert(brDesc.each);
                });
        //]]>
        </script>

I tried searching trac, but found nothing specific to this issue.

Regards,

Rob

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to