Bug 22539 - An empty <a> element inside an HTML document taints the following elements' CSS type information
Summary: An empty <a> element inside an HTML document taints the following elements' C...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-28 00:28 PST by Alexander Mitin
Modified: 2009-02-11 21:41 PST (History)
1 user (show)

See Also:


Attachments
Reduction (based on Alexander Mitin's example) (714 bytes, text/html)
2009-02-11 21:41 PST, Julien Chaffraix
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Mitin 2008-11-28 00:28:02 PST
I beleive I've found a bug while rendering the xhtml transitional document by WebKit nightly (28.11.2008), Safari 3.2.1 and the latest Chrome affected as well.
Here is the simple test case:

test.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> 
    <title>test</title> 
    <link rel="stylesheet" href="default.css" type="text/css" />
</head> 
<body> 
<table border="1"> 
    <tr><td> <a name="top" /> 
    <table> 
        <tr><td> <a name="23" /> 
        <table border="1"> 
            <tr>
                <td>text1</td>
                <td>text2</td>
            </tr> 
            <tr><td colspan="2"><a href="#top">top</a></td></tr>
        </table> 
        </td></tr> 
        <tr><td> <a name="12" /> 
        <table border="1"> 
            <tr>
                <td>text3</td>
                <td>text4</td>
            </tr> 
            <tr><td colspan="2"><a href="#top">top</a></td></tr>
        </table> 
        </td></tr> 
    </table>
    </td></tr> 
</table>
</body> 
</html> 

default.css:
a:link, a:active, a:visited
{ 
	color: #006699;
	text-decoration:none;
}
a:hover
{
	text-decoration:none;
	color: #EE4000;
}

The document passes the validation by w3c online at http://validator.w3.org/

Actual behaviour:
Text in table cells change its color by mouse hovering on it as if it surrounded by <a> tag.
Expected behaviour:
Text in table cells stay black.
Comment 1 Julien Chaffraix 2009-02-08 06:36:22 PST
While trying to reproduce the bug, I noticed something with your test case. I made the mistake of serving it with a Content-Type of text/html and I could definitely reproduce the bug.
However if I served it with a Content-Type of application/xhtml+xml, the behaviour is correct.

Could you confirm that you fell into the same pitfall so that we can update the bug and reduce the test case a bit more?
Comment 2 Alexander Mitin 2009-02-09 10:37:19 PST
When I saw this behavior the Content-Type was set to 'text/html'. Sorry, can't test it using the Content-Type set to 'application/xhtml+xml' but I believe that it would work as expected. And one more thing: when I created the test case I loaded it into browser directly using file: proto (not using http-server) and the error persisted. 
Comment 3 Julien Chaffraix 2009-02-11 21:38:30 PST
Thanks for your reply. I have tweaked the bug information with your comment and to reflect my research on this.

FYI the Inspector suggests strongly an HTML DOM bug as the empty <a> tags seem to contain other elements.
Comment 4 Julien Chaffraix 2009-02-11 21:41:42 PST
Created attachment 27586 [details]
Reduction (based on Alexander Mitin's example)