Bug 96694

Summary: createHTMLDocument() should not create a title element if the title argument is left out
Product: WebKit Reporter: Ojan Vafai <ojan>
Component: DOMAssignee: Erik Arvidsson <arv>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, ap, arv, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
Attachments:
Description Flags
Patch
none
Patch for landing none

Comment 1 Alexey Proskuryakov 2012-09-14 13:17:45 PDT
What do actual browsers do? The e-mail linked above is kind of cryptic.
Comment 2 Ojan Vafai 2012-09-14 13:23:03 PDT
The rest of the thread talks about that. From the thread, it sounds like other browsers currently throw an error.
Comment 3 Erik Arvidsson 2012-10-02 09:46:23 PDT
Created attachment 166702 [details]
Patch
Comment 4 Darin Adler 2012-10-02 09:49:54 PDT
Comment on attachment 166702 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=166702&action=review

Looks fine. The risk of compatibility problems seems small.

> LayoutTests/fast/dom/DOMImplementation/createHTMLDocument-optional-title.html:7
> +var doc = document.implementation.createHTMLDocument();
> +shouldBeNull('doc.querySelector("title")');

Way better to write these as one-liner tests:

    shouldBeNull('document.implementation.createHTMLDocument().querySelector("title")');
    shouldBeEqualToString('document.implementation.createHTMLDocument(null).querySelector("title").textContent', 'null');

That way the test output will show what we’re testing.
Comment 5 Erik Arvidsson 2012-10-02 12:13:45 PDT
Created attachment 166728 [details]
Patch for landing
Comment 6 Ojan Vafai 2012-10-02 12:20:56 PDT
Comment on attachment 166728 [details]
Patch for landing

View in context: https://bugs.webkit.org/attachment.cgi?id=166728&action=review

> LayoutTests/fast/dom/DOMImplementation/createHTMLDocument-optional-title.html:10
> +shouldBeEqualToString('document.implementation.createHTMLDocument(undefined).querySelector("title").textContent', 'undefined');
> +shouldBeEqualToString('document.implementation.createHTMLDocument("").querySelector("title").textContent', '');

This doesn't seem to match http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument. I'd expect leaving the argument out being the same as passing in undefined and passing the empty string to create an empty title element.

What am I missing?
Comment 7 Erik Arvidsson 2012-10-02 12:31:48 PDT
(In reply to comment #6)
> What am I missing?

This was resolved over IRC
Comment 8 Ojan Vafai 2012-10-02 12:31:55 PDT
Comment on attachment 166728 [details]
Patch for landing

View in context: https://bugs.webkit.org/attachment.cgi?id=166728&action=review

>> LayoutTests/fast/dom/DOMImplementation/createHTMLDocument-optional-title.html:10
>> +shouldBeEqualToString('document.implementation.createHTMLDocument("").querySelector("title").textContent', '');
> 
> This doesn't seem to match http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument. I'd expect leaving the argument out being the same as passing in undefined and passing the empty string to create an empty title element.
> 
> What am I missing?

Oh, nevermind. I misread. Doing too many things at once. :(
Comment 9 WebKit Review Bot 2012-10-02 13:35:36 PDT
Comment on attachment 166728 [details]
Patch for landing

Clearing flags on attachment: 166728

Committed r130203: <http://trac.webkit.org/changeset/130203>
Comment 10 WebKit Review Bot 2012-10-02 13:35:40 PDT
All reviewed patches have been landed.  Closing bug.