#157 ✓resolved
Paulo Pereira

CSS Selector finds only the first in Opera.

Reported by Paulo Pereira | June 10th, 2008 @ 12:04 AM | in 1.6.0.3

I have this function:


  // the variables used are these:
  // to_hide = ['global', 'local'];
  // to_show = ['group'];

  to_hide.each(function(el){
    $$('table.cs_table td.cs_'+el).invoke('hide');
  });

  to_show.each(function(el){
    $$('table.cs_table td.cs_'+el).invoke('show');
  });

The problem is that in Opera, this only works for the FIRST td.cs_global, td.cs_local, td.cs_group in the FIRST table.cs_table

But, if I do it like this:


  // the variables used are these:
  // to_hide = ['global', 'local'];
  // to_show = ['group'];

  to_hide.each(function(el){
    $$('#call_status_div td.cs_'+el).invoke('hide');
  });

  to_show.each(function(el){
    $$('#call_status_div td.cs_'+el).invoke('show');
  });

This will work in Opera.

Extract from the DOM tree:


<HTML xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <HEAD></HEAD>
  <BODY>
    <DIV id="logobar"></DIV>
    <DIV id="errorbar"></DIV>
    <UL id="menu" class=""></UL>
    <DIV id="right_sidebar"></DIV>
    <DIV id="container">
      <DIV id="ivr_info_div" style="display: none"></DIV>
      <DIV id="current_info_div" style="display: none"></DIV>
      <DIV id="call_status_div" style="">
        <P class="options"></P>
        <DIV class="trace" id="call_status_options" style="display: none"></DIV>
        <DIV id="cs_table_tbody">
          <DIV class="content_wrapper">
            <H2></H2>
            <TABLE class="cs_table">
              <TBODY>
                <TR>
                  <TD></TD>
                  <TD class="number"></TD>
                  <TD class="cs_bar cs_global"></TD>
                  <TD class="cs_bar cs_group" style="display: none"></TD>
                  <TD class="cs_bar cs_local" style="display: none"></TD>
                  <TD class="number"></TD>
                </TR>
                <TR>
                  <TD></TD>
                  <TD class="number"></TD>
                  <TD class="cs_bar cs_global"></TD>
                  <TD class="cs_bar cs_group" style="display: none"></TD>
                  <TD class="cs_bar cs_local" style="display: none"></TD>
                  <TD class="number"></TD>
                </TR>
                <TR></TR>
                <TR></TR>
              </TBODY>
            </TABLE>
          </DIV>
          <DIV class="content_wrapper">
            <H2></H2>
            <TABLE class="cs_table">
              <TBODY>
                <TR>
                  <TD></TD>
                  <TD class="number"></TD>
                  <TD class="cs_bar cs_global"></TD>
                  <TD class="cs_bar cs_group"></TD>
                  <TD class="cs_bar cs_local"></TD>
                  <TD class="number"></TD>
                </TR>
                <TR></TR>
                <TR></TR>
                <TR></TR>
              </TBODY>
            </TABLE>
          </DIV>
          <DIV class="content_wrapper"></DIV>
          <DIV class="content_wrapper"></DIV>
          <DIV class="content_wrapper"></DIV>
          <DIV class="content_wrapper"></DIV>
        </DIV>
      </DIV>
      <DIV id="channel_info_div" style="display: none"></DIV>
      <DIV id="channel_graph_div" style="display: none"></DIV>
      <DIV id="service_info_div" style="display: none"></DIV>
      <DIV id="service_graph_div" style="display: none"></DIV>
      <DIV id="board_info_div" style="display: none"></DIV>
    </DIV>
    <DIV id="ivrs_table_div"></DIV>
    <DIV style="clear:both"></DIV>
    <DIV style="clear:both; display: none;" id="test"></DIV>
  </BODY>
</HTML>

Comments and changes to this ticket

  • Juriy Zaytsev

    Juriy Zaytsev June 10th, 2008 @ 03:53 AM

    Which version of Opera would that be?

  • Andrea Baron

    Andrea Baron June 12th, 2008 @ 06:27 PM

    I can confirm this bug exists in Opera 9.5 final (in good company with other bugs...).

    The problem to me appears with $$('.vote .stars'), but if I use $('.vote>.stars') it returns all the elements.

  • John-David Dalton

    John-David Dalton June 16th, 2008 @ 09:49 PM

    • Assigned user set to “Andrew Dupont”

    What about Opera 9.25.

    I am finding Opera 9.5+ has some xpath bugs.

  • John-David Dalton

    John-David Dalton June 16th, 2008 @ 09:50 PM

    • State changed from “new” to “bug”
  • John-David Dalton

    John-David Dalton June 19th, 2008 @ 04:12 PM

    • Milestone set to 1.6.0.3

    This ticket is related to this:

    Opera 9.5: unit test$$MatchesAncestryWithTokensSeparatedByWhitespace fails

    http://prototype.lighthouseapp.c...

  • John-David Dalton

    John-David Dalton June 19th, 2008 @ 04:49 PM

    if I add something like

        // Opera 9.5b+ chokes on descendant selectors and :not
        if (Prototype.Browser.Opera &&
         parseFloat(opera.version()) >= 9.5 && e.indexOf(" ") > -1)
          return false;
    

    to the Selector.shouldUseXPath I get around the issue of the test$$$MatchesAncestryWithTOkensSeparatedByWhitespace issue but then the

    testSelectorWithNot will fail:

    10 assertions, 2 failures, 0 errors
    Failure: last-of-type
    expected <[<a id="link_1" class="first internal">]>, actual: <[<a id="link_1" class="first internal">, <a id="link_2" class="internal highlight">]>
    Failure: nth-last-of-type
    expected <[<a id="link_1" class="first internal">]>, actual: <[<a id="link_1" class="first internal">, <a id="link_2" class="internal highlight">]>
    
  • GitHub Robot

    GitHub Robot June 24th, 2008 @ 08:29 PM

    • State changed from “bug” to “resolved”

    (from [6cdef71df792ae67ea1ecb4e69c64db5a3d03a0c]) Fix issue where Opera gets confused by complex selectors in $$. [#157 state:resolved]

    http://github.com/sstephenson/pr...

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 02:10 AM

    • Tag set to opera, section:dom

    [not-tagged:"dom" tagged:"section:dom" bulk edit command]

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 12:44 PM

    • Tag changed from opera, section:dom to section:dom

    [not-tagged:"opera" bulk edit command]

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

Referenced by

Pages