Bug 11321 - Element with :target pseudo-class still matched after fragment identifier change
Summary: Element with :target pseudo-class still matched after fragment identifier change
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 420+
Hardware: Macintosh OS X 10.4
: P2 Normal
Assignee: Nobody
URL: http://xkr.us/bugs/webkit-06-003.html
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-16 15:03 PDT by Brad Fults
Modified: 2006-11-19 04:01 PST (History)
0 users

See Also:


Attachments
Testcase (856 bytes, text/html)
2006-10-16 15:03 PDT, Brad Fults
no flags Details
first attempt (1.41 KB, patch)
2006-10-24 12:03 PDT, Rob Buis
mjs: review-
Details | Formatted Diff | Diff
This timewith testcase (15.96 KB, text/plain)
2006-11-17 14:35 PST, Rob Buis
no flags Details
Now with improved testcase (15.96 KB, patch)
2006-11-18 06:31 PST, Rob Buis
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brad Fults 2006-10-16 15:03:27 PDT
Open the given URL (or see attachment), follow the steps.

Summary:

An element styled with the :target pseudo-class will still be matched after the fragment identifier changes.

Expected:

Elements styled with the :target pseudo-class should only be matched when the fragment identifier matches the id of the element.
Comment 1 Brad Fults 2006-10-16 15:03:54 PDT
Created attachment 11120 [details]
Testcase
Comment 2 Brad Fults 2006-10-16 15:04:13 PDT
*** This bug has been confirmed by popular vote. ***
Comment 3 Rob Buis 2006-10-24 12:03:47 PDT
Created attachment 11192 [details]
first attempt

This patch fixes the problem. Please let me know whether it is the right approach and how
to do testcase(s).
Cheers,

Rob.
Comment 4 Maciej Stachowiak 2006-10-31 04:31:35 PST
Comment on attachment 11192 [details]
first attempt

The fix looks ok to me, however, it needs a test case. To make a test case for this, you will probably have to make a page that navigates to a #fragment via window.location, forces a layout to make the :target pseudo match (for example by asking for a clientHeight property), then navigates to no fragment at all. Please resubmit with test case. The code change looks fine however.
Comment 5 Rob Buis 2006-11-17 14:35:00 PST
Created attachment 11557 [details]
This timewith testcase

This is a testcase for the bug. Unfortunately the .txt is not what I expected, whereas the .png is
correct. I'd appreciate it if anybody has suggestions for the .txt problem.
Cheers,

Rob.
Comment 6 Rob Buis 2006-11-18 06:31:41 PST
Created attachment 11566 [details]
Now with improved testcase

This testcase is much better (thnx to Mitz) since it really reflects that the bgcolor is removed when the target pseudo-class does not match anymore.
Cheers,

Rob.
Comment 7 Brad Fults 2006-11-18 13:50:05 PST
FWIW you should probably use location.hash = "#target-01"; in target-fragment-match.html.
Comment 8 Maciej Stachowiak 2006-11-18 14:48:29 PST
Comment on attachment 11566 [details]
Now with improved testcase

r=me
Comment 9 Rob Buis 2006-11-19 04:01:38 PST
Landed in r17848.