Bug 18026 - CSS3 Selector Test: combination of hover and general sibling selector fails in Webkit
Summary: CSS3 Selector Test: combination of hover and general sibling selector fails i...
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://disruptive-innovations.com/zoo...
Keywords: HasReduction
Depends on:
Blocks: 12520
  Show dependency treegraph
Reported: 2008-03-23 13:59 PDT by Robert Blaut
Modified: 2022-01-28 05:10 PST (History)
7 users (show)

See Also:

test case (402 bytes, text/html)
2008-03-23 13:59 PDT, Robert Blaut
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Blaut 2008-03-23 13:59:35 PDT
The CSS3 selectors test suite check this particular case:

 .tilda .t1:hover ~ .unitTest { background-color: red; }

It fails in Webkit.
Comment 1 Robert Blaut 2008-03-23 13:59:57 PDT
Created attachment 19986 [details]
test case
Comment 2 Yusuke Sato 2009-07-27 01:00:10 PDT
The patch I attached on Bug 18027 (hover-adjacent-v1) also fixes this bug.

Comment 3 Andy E 2011-02-09 09:06:48 PST

I believe the patch you attached on Bug 18027 doesn't fix this problem fully.  I was helping a developer with a demo that involves highlighting elements that are floated to the right.  As you move from the left element through the other elements, they each remain highlighted up to the currently hovered element - which is correct behavior.  However, when moving the mouse away from all the elements the highlight should be removed completely but it isn't.  Also, hovering over the elements individually doesn't achieve the desired effect.

The demo I was working on is located at http://jsfiddle.net/H9Rn6/.  The code is as follows:


    <div id="container">
        <div class="iconFavorite"></div>
        <div class="iconFavorite"></div>
        <div class="iconFavorite"></div>
        <div class="iconFavorite"></div>
        <div class="iconFavorite"></div>


    .iconFavorite:hover, .iconFavorite:hover ~ div {
        background-image: url(http://www.custom52.com/Images/star_icon.gif);
        float: right;
        background: url(http://t3.gstatic.com/images?q=tbn:ANd9GcRk4Mbns-pCrOXWL5WIiY-iy6syBtYLKzJKc5GSa9Ak9RGM_uDbEg&t=1) no-repeat;
        width: 16px;
        height: 16px;
        border: none;

Internet Explorer 7+, Firefox 2+ and Opera 9+ all exhibit the correct behavior.
Comment 4 Andy E 2011-02-09 09:23:12 PST
Furthermore, it seems that the ~ adjacent sibling selector is buggy when used dynamically in general.  Using my previous example to apply the hover effect using JavaScript -- whilst retaining the ~ selector for adjacent siblings -- results in styles not being applied to the adjacent siblings.


Still working as expected in non-WebKit browsers.
Comment 5 Dave 2011-05-07 10:52:30 PDT

To reproduce:

To get a more detailed explanation:
Comment 6 Jamy 2011-07-28 07:25:56 PDT
When will this be solved? Even IE7 can do this properly... 
Comment 7 Jamy 2021-05-02 02:42:21 PDT
This was fixed long ago and can be closed :)
Comment 8 Antti Koivisto 2022-01-28 05:10:18 PST