WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
27780
Whitespace after the <head> but before the <body> lost during parsing
https://bugs.webkit.org/show_bug.cgi?id=27780
Summary
Whitespace after the <head> but before the <body> lost during parsing
Justin Garcia
Reported
2009-07-28 14:30:49 PDT
If I have something like: <html> <head><script> function foo() { alert(document.documentElement.innerHTML); } </script></head> <body>World</body> </html> I see that the whitespace after </head> and before <body> is lost. See the attached test case.
Attachments
test case
(297 bytes, text/html)
2009-07-28 14:31 PDT
,
Justin Garcia
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Justin Garcia
Comment 1
2009-07-28 14:31:09 PDT
Created
attachment 33671
[details]
test case
Dave Hyatt
Comment 2
2009-07-28 15:01:36 PDT
Are you sure it's lost? I think the significant whitespace following the </head> causes the parser to have to open a <body> implicitly.... so the whitespace is probably just inside the <body> instead...
Andy Matuschak
Comment 3
2009-07-28 15:29:22 PDT
That's a sensible explanation, but from the viewpoint of roundtripping HTML, it would be really nice if that *didn't* happen... :)
Andy Matuschak
Comment 4
2009-07-28 20:35:41 PDT
Upon investigation it seems that this is not the case. The whitespace is actually lost.
Alexey Proskuryakov
Comment 5
2009-07-29 17:55:16 PDT
Is this significant whitespace in your test? I'm not absolutely sure, but I think that you'd need an XML document with xml:space="preserve" to make this whitespace significant.
Andy Matuschak
Comment 6
2009-07-29 17:59:08 PDT
Regardless of whether it's significant, when making tools that work with HTML the user wants to round-trip, this behavior is undesirable.
Anne van Kesteren
Comment 7
2023-04-01 00:24:49 PDT
This behavior is covered by the HTML Standard.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug