Bug 17091 - doctype.ownerDocument is null after creation (Acid3 bug)
Summary: doctype.ownerDocument is null after creation (Acid3 bug)
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-30 00:53 PST by Eric Seidel (no email)
Modified: 2008-01-30 11:44 PST (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 Eric Seidel (no email) 2008-01-30 00:53:21 PST
doctype.ownerDocument is null after creation (Acid3 bug)

This should be an easy fix.

Test 98: expected: [object HTMLDocument], got: null - doctype's ownerDocument was wrong after creation

    function () {
      // test 98: XHTML and the DOM
      // (special test)
      var doctype = document.implementation.createDocumentType("html", "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
      assertEquals(doctype.ownerDocument, document, "doctype's ownerDocument was wrong after creation");
      var doc = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", doctype);
      doc.documentElement.appendChild(doc.createElementNS("http://www.w3.org/1999/xhtml", "head"));
      doc.documentElement.appendChild(doc.createElementNS("http://www.w3.org/1999/xhtml", "body"));
      var t = doc.createElementNS("http://www.w3.org/1999/xhtml", "title");
      doc.documentElement.firstChild.appendChild(t);
      // ok we have a conforming XHTML1 doc in |doc| now.
      assertEquals(doctype.ownerDocument, doc, "doctype's ownerDocument didn't change when it was assigned to another document");
      assertEquals(doc.title, "", "document had unexpected title");
      t.textContent = "Sparrow";
      assertEquals(doc.title, "Sparrow", "document.title did not update dynamically");
      doc.body.appendChild(doc.createElementNS("http://www.w3.org/1999/xhtml", "form"));
      assertEquals(doc.forms.length, 1, "document.forms not updated after inserting a form");
      return 7;
    },
Comment 1 Eric Seidel (no email) 2008-01-30 01:00:26 PST
Hum...

    // Returns the DOM ownerDocument attribute. This method never returns NULL, except in the case 
    // of (1) a Document node or (2) a DocumentType node that is not used with any Document yet. 
    virtual Document* ownerDocument() const;
Comment 2 Eric Seidel (no email) 2008-01-30 01:05:58 PST
This test is clearly wrong according to the DOM Level 2 Core spec:
http://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType

Ian, if you agree (and plan to change the test) feel free to close this INVALID.
Comment 3 Ian 'Hixie' Hickson 2008-01-30 11:44:40 PST
I fixed this yesterday, shortly after adding the test. Sorry for the confusion.