#428 ✓duplicate
arno.

bug with $$('#main li a') and opera

Reported by arno. | November 6th, 2008 @ 10:24 PM

Hi, I found a bug with $$ handling in opera. In testcase, I have two lists each containing one anchor, $$('#main li a') should returns two anchors, it returns only one in opera.

my opera version is: Opera/9.51 (X11; Linux i686; U; en)

Comments and changes to this ticket

  • Xanadu

    Xanadu November 7th, 2008 @ 12:26 AM

    Remove the brackets around the $$-call. I doubt this is a bug. Please test.

    By the way: why not use Element#update?

    $('res').update($$('#main li a').join(' '));
    
    
  • Xanadu

    Xanadu November 7th, 2008 @ 12:42 AM

    Sorry, my assumption is wrong. I have tested it adding ul to the selector, which works.

    $$('#main ul li a');
    
    
  • Xanadu

    Xanadu November 7th, 2008 @ 12:59 AM

    • Assigned user set to “Andrew Dupont”

    I made a few test cases. They should all return 2, as there are 2 elements in the page.

    Two of them return a array with 1 element in Opera 9.52 on Windows:

    $$('#main li a')
    $$('li a')
    
    

    Test cases:

    <script type="text/javascript">
    //<![CDATA[
    Event.observe(document, 'dom:loaded', function ()
    {
        $('res').update(
            "$$('#main a') = " + $$('#main a').size() + "<br />" +
            "$$('#main li a') = " + $$('#main li a').size() + "<br />" +
            "$$('#main ul li a') = " + $$('#main ul li a').size() + "<br />" +
            "$$('#main ul a') = " + $$('#main ul a').size() + "<br />" +
            "$$('#main * a') = " + $$('#main * a').size() + "<br />" +
            "$$('#main a') = " + $$('#main a').size() + "<br />" +
            "$$('li a') = " + $$('li a').size() + "<br />" +
            "$$('ul li a') = " + $$('ul li a').size() + "<br />" +
            "$$('ul a') = " + $$('ul a').size() + "<br />" +
            "$$('a') = " + $$('a').size() + "<br />" +
            "$$('* a') = " + $$('* a').size() + "<br />"
        );
    });
    //]]>
    </script>
    
    
  • Xanadu

    Xanadu November 7th, 2008 @ 01:00 AM

    • Assigned user cleared.
  • Juriy Zaytsev

    Juriy Zaytsev November 7th, 2008 @ 01:10 AM

    • Assigned user set to “Andrew Dupont”

    @Xanadu

    Thanks for testing this!

    Before I mark it as a bug, I'd like to make sure it's not a duplicate of #395

  • arno.

    arno. November 7th, 2008 @ 01:25 AM

    Le Friday 07 November 2008, à 00:10:30AM +0000, Lighthouse a écrit :

    I had investigated the bug, and discovered it comes from opera not handling //[local-name()='li' or local-name()='LI']//[local-name()='a' or local-name()='A'] correctly. So it really looks like the bug you pointed.

  • Juriy Zaytsev

    Juriy Zaytsev November 7th, 2008 @ 04:46 AM

    • State changed from “new” to “duplicate”

    Thanks, closing as duplicate.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

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

The Prototype JavaScript library.

Shared Ticket Bins

Attachments

Referenced by

Pages