Bug 37834 - Does not correctly parse OBJECT tags within HEAD
Summary: Does not correctly parse OBJECT tags within HEAD
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-19 17:41 PDT by Roarke Lynch
Modified: 2010-04-20 19:07 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roarke Lynch 2010-04-19 17:41:16 PDT
When an OBJECT is included as a child element to  HTML / HEAD Webkit reports the following error and migrates the OBJECT into the BODY. OBJECT is a valid child of HEAD (http://www.w3.org/TR/xhtml1-schema/). This behavior is still seen when declare="declare" in the OBJECT tag, and does not seem to matter what value the type attribute is given.

INPUT HTML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Test</title>
		<object type="text/html" declare="declare">
			<h1>Hello World</h1>
		</object>
	</head>
	<body>
		
	</body>
</html>

CONSOLE OUTPUT:
Unmatched </head> encountered.  Ignoring tag.
Extra <body> encountered.  Migrating attributes back to the original <body> element and ignoring the tag.
Comment 1 Alexey Proskuryakov 2010-04-20 12:23:24 PDT
I cannot reproduce this with your example saved into an .xhtml file.

Are you sure you aren't serving your document as text/html? If that's the case, it's treated as HTML, and all "<?xml?>" and "xmlns" incantations are discarded as garbage.

Migrating misplaced OBJECT to BODY is correct behavior for HTML.
Comment 2 Roarke Lynch 2010-04-20 18:42:21 PDT
The error is not reported when the document is served as application/xhtml+xml, however I am confused by the behavior on text/html documents. In the HTML DTD (http://www.w3.org/TR/REC-html40/sgml/dtd.html) OBJECT is a valid child for HEAD:

<!ENTITY % head.misc "SCRIPT|STYLE|META|LINK|OBJECT" -- repeatable head elements -->
Comment 3 Alexey Proskuryakov 2010-04-20 19:07:05 PDT
This behavior is in accordance with HTML5 draft.

I checked that we match Firefox here. I didn't test other browsers, but the fact that HTML5 specifies this behavior would generally mean that either all major browsers agree (and disagree with HTML4), or there was another really important reason to make a change. I don't know the history of this specific change.