Bug 15647 - HEAD elements are not automatically generated in empty documents.
Summary: HEAD elements are not automatically generated in empty documents.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 523.x (Safari 3)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2007-10-23 17:05 PDT by Kevin Decker
Modified: 2009-09-01 15:54 PDT (History)
2 users (show)

See Also:


Attachments
test 1 (301 bytes, text/html)
2007-10-26 11:10 PDT, Alexey Proskuryakov
no flags Details
test 2 (758 bytes, text/html)
2007-10-26 11:11 PDT, Alexey Proskuryakov
no flags Details
test 2 (780 bytes, text/html)
2007-10-26 11:13 PDT, Alexey Proskuryakov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Decker 2007-10-23 17:05:50 PDT
HEAD elements are not automatically generated in empty documents.

* STEPS TO REPRODUCE

1. Create an about:blank document.

Notice there's an auto generated body element, but not head element.  Having a auto generated head element matches behavior of other browsers and is important for a high profile email site.
Comment 1 Alexey Proskuryakov 2007-10-26 11:10:43 PDT
Created attachment 16884 [details]
test 1
Comment 2 Alexey Proskuryakov 2007-10-26 11:11:01 PDT
Created attachment 16885 [details]
test 2
Comment 3 Alexey Proskuryakov 2007-10-26 11:13:15 PDT
Created attachment 16886 [details]
test 2

Updated to work in Safari, not just in Firefox...
Comment 4 Robert Blaut 2008-03-04 15:40:04 PST
The problem is clearly visible in Live DOM Viewer: http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E 

Gecko and Presto generate the head element.  Webkit in this case violates the HTML5 spec: http://www.whatwg.org/specs/web-apps/current-work/#before5
Comment 5 Alexey Proskuryakov 2009-09-01 15:54:03 PDT
This was fixed in <http://trac.webkit.org/changeset/43215>.

Test2 still fails, and this is because we don't create HTML and HEAD nodes immediately from document.write() - we create them when closing a document if they still don't exist. This is a difference with Firefox, but IE behaves the same.