Fixes #1043: we were passing in '#document' as the ownerDocument parameter to Node when initializing Document. But, it didn't matter, since (a) we overrode it with `this` anyway a few lines later; (b) we shadowed the ownerDocument getter to return `null` correctly for documents.
Caused by d7790e7
parentWindow was nonstandard, although unfortunately we've been recommending it in our docs for some time.
This dynamically rewrites the provided source code to always refer to window if it's a global variable. Caveats: * toString() of functions will return different results: a "window." prefix on global vars and whitespace modifications * Refering to undefined variables will not throw an error due to the window prefix for now. This might be fixable by throwing the error ourselves.
Fixes #1015. The web-platform-tests are sufficient; before this change they failed with the same error as given in that issue, and afterward they pass.
- Updated `DOMImplementation` to mostly work per-spec, including removing/neutering public feature-related methods and fixing up the createDocument and createHTMLDocument methods. - Re-did the `CharacterData` implementation to follow the algorithms in the DOM Standard; this notably removes a few exceptions. - Re-did `Comment`, `Text`, and `ProcessingInstruction` to follow the DOM Standard and derive from `CharacterData`. - Re-did `DocumentType` to follow the DOM Standard and be much simpler. - Fixed a variety of accessors on `Node` and `Element`; some were removed that were nonstandard (especially setters); others were updated to reflect the spec; etc. - Removed all traces of entities, entity types, notations, default attributes, and CDATA sections. - Re-did name/qname validation to work with the xml-name-validator package and some centralized algorithms. This necessitates a new workaround so the parser can create attributes with invalid names, similar to how it already does for elements. - Made the XML parser at least somewhat aware of processing instructions. - Cleaned up doctype parsing and association between doctypes and documents. - Cleaned up parsingMode and its relation to the initialization lifecycle. contentType now generally reflects the given parsingMode, unless overidden. - Moved some properties to Document.prototype and Window.prototype instead of setting them as own properties during the document/window creation. - Moved the Location object to live on the document, not the window, as per spec; `window.location` gets the Location object of its associated document. As part of this a *lot* of tests had to be updated. A few common themes: - Try to have documents be parsed via the public API, instead of creating them using internal constructors - Properly test XML as XML, in the XML parsing mode - Remove a bunch of tests related to obsolete things - Try to update attribute-related tests to reference `name` instead of `nodeName`, since eventually we want to get rid of `nodeName` for attributes
- Remove examples because they referenced the old level stuff and also they were pretty lame - Still TODO: cleanup living/* to not refer to separate core and html. This was kind of rushed so there's probably more cleanup to do. But all tests pass!!!