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.
Created attachment 11120 [details] Testcase
*** This bug has been confirmed by popular vote. ***
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 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.
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.
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.
FWIW you should probably use location.hash = "#target-01"; in target-fragment-match.html.
Comment on attachment 11566 [details] Now with improved testcase r=me
Landed in r17848.