Bug 13279

Summary: Block-element inside inline-element produces unexpected styling
Product: WebKit Reporter: Michael Dreimiller <mcd>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Trivial CC: mcd, webkit
Priority: P5    
Version: 523.x (Safari 3)   
Hardware: Mac (Intel)   
OS: OS X 10.4   
URL: http://www.dreimiller.com/theday-test/theday-mod-2.html

Description Michael Dreimiller 2007-04-04 07:39:48 PDT
My local newspaper's web site [http://www.theday.com/] has some articles that display entirely in italics in Safari, yet they render correctly in other Mac browsers (Camino, Opera, Firefox) and on other OS platforms. I determined that the articles that had that problem had a <p /> tag inside of a <span> tag immediately preceeding the article body, which was also inside a span tag. I simplied one of these pages (see the URL field on this report). There were two things that caught my eye.

1) The page has a DOCTYPE of HTML 4.01 Transistional yet they are using XHTML tags in their code.

2) They are using block-elements like <p />  inside of inline elements like <span></span>.

I realize that this is technically not a bug since their code does not validate. Just thought it was worth sharing since Safari handles the improper code differently than other browsers. I've tested this in the current release version of Safari as well as the latest nightly build and they both behave the same.

Since the articles on their web site expire after 7 days I've posted the code from one of their unaltered articles here for reference [http://www.dreimiller.com/theday-test/TheDay.html}.

I've sent them this information and suggested that they change their tags from span to div when they need to use block-elements but they haven't responded yet.

-McD-
Comment 1 Dave Hyatt 2007-04-04 13:45:11 PDT
My guess is that this is invalid.  We mostly parse according to the HTML5 specification in the WHATWG.
Comment 2 Robert Blaut 2008-02-14 02:28:22 PST
Per Dave's comment I resolve the bug as INVALID. I checked also the page in Webkit r30218 and found no problem. They changed DOCTYPE to: 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">