Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update DOMImplementation according to recent specs #210

Merged
merged 4 commits into from
Jun 9, 2021

Conversation

karfau
Copy link
Member

@karfau karfau commented Apr 4, 2021

  • deprecate hasFeature and simplify implementation according to the latest spec
  • createDocumentType sets publicId and systemId to an empty string instead of undefined
  • createDocument sets docType to null instead of undefined
  • export DocumentType, Element, Node and NodeList to verify instanceof in tests
  • update doc comments with links to specs and type information

This PR is part of the preparation for solving #203

@karfau karfau added documentation Improvements or additions to documentation spec:DOM-Level-2 https://www.w3.org/TR/DOM-Level-2-Core/ spec:DOM Living Standard https://dom.spec.whatwg.org/ testing labels Apr 4, 2021
@karfau karfau requested a review from brodybits April 4, 2021 18:19
- deprecate `hasFeature` and simplify implementation according to the latest spec
- `createDocumentType` sets `publicId` and `systemId` to an empty string instead of `undefined`
- `createDocument` sets `docType` to `null` instead of `undefined`
- export `DocumentType`, `Element`, `Node` and `NodeList` to verify instanceof in tests
@karfau karfau changed the title fix: Verify DOMImplementation against (latest) specs fix: Verify DOMImplementation against (latest) specs Apr 4, 2021
Comment on lines -252 to -272
function DOMImplementation(/* Object */ features) {
this._features = {};
if (features) {
for (var feature in features) {
this._features = features[feature];
}
}
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous implementation left the definition of features and versions that are supported to the code that calls the constructor, which doesn't make any sense at all. This was one more reason why I decided to not keep or fix it, but to implement it as it is specified in the living standard.

lib/dom.js Outdated Show resolved Hide resolved
@brodybits brodybits changed the title fix: Verify DOMImplementation against (latest) specs feat: Update DOMImplementation according to recent specs May 9, 2021
lib/dom.js Outdated Show resolved Hide resolved
Element,
Node,
NodeList,
} = require('../../lib/dom')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would favor that we export and use these from lib/index.js, as I proposed in PR #233.

Copy link
Member Author

@karfau karfau May 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it mean you want to land #233 first? Since lib/index.js doesn't exist on master yet.

It currently already has a conflict and I raised two questions there.
If you think it's important to solve this before anything else, let's focus on that issue.
If not I would prefer to leave this as is in this PR, land it and continue to solve that issue in the related PR.

@karfau karfau merged commit 6d0bc6c into xmldom:master Jun 9, 2021
@karfau karfau deleted the test-doc/dom-implementation branch June 9, 2021 22:08
karfau added a commit to ChALkeR/xmldom that referenced this pull request Jul 27, 2021
- deprecate `hasFeature` and simplify implementation according to the latest spec
- `createDocumentType` sets `publicId` and `systemId` to an empty string instead of `undefined`
- `createDocument` sets `docType` to `null` instead of `undefined`
- export `DocumentType`, `Element`, `Node` and `NodeList` to verify `instanceof` in tests
- update doc comments with links to specs and type information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation spec:DOM Living Standard https://dom.spec.whatwg.org/ spec:DOM-Level-2 https://www.w3.org/TR/DOM-Level-2-Core/ testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants