From 16afec6ab222eb23b9b3a7abddd99fb51e45b787 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 07:30:29 +0200 Subject: [PATCH 01/14] chore(deps): update step-security/harden-runner action to v2.10.0 (#729) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [step-security/harden-runner](https://redirect.github.com/step-security/harden-runner) | action | minor | `v2.9.1` -> `v2.10.0` | --- ### Release Notes
step-security/harden-runner (step-security/harden-runner) ### [`v2.10.0`](https://redirect.github.com/step-security/harden-runner/releases/tag/v2.10.0) [Compare Source](https://redirect.github.com/step-security/harden-runner/compare/v2.9.1...v2.10.0) #### What's Changed Release v2.10.0 by [@​h0x0er](https://redirect.github.com/h0x0er) and [@​varunsh-coder](https://redirect.github.com/varunsh-coder) in [https://github.com/step-security/harden-runner/pull/455](https://redirect.github.com/step-security/harden-runner/pull/455) **ARM Support**: Harden-Runner Enterprise tier now supports GitHub-hosted ARM runners. This includes all the features that apply to previously supported GitHub-hosted x64 Linux runners. **Full Changelog**: https://github.com/step-security/harden-runner/compare/v2...v2.10.0
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/xmldom/xmldom). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/dependency-review.yml | 2 +- .github/workflows/examples.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- .github/workflows/test-node.js.yml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index bf2dcfbae..3f8d3f09d 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 with: egress-policy: audit diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index d827b8394..d74cc8f93 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -26,7 +26,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 with: egress-policy: audit @@ -59,7 +59,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 with: egress-policy: audit diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 5c4f54bc9..d18a2cccb 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -32,7 +32,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 with: egress-policy: audit diff --git a/.github/workflows/test-node.js.yml b/.github/workflows/test-node.js.yml index 5a5f99a44..7c01784c4 100644 --- a/.github/workflows/test-node.js.yml +++ b/.github/workflows/test-node.js.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 with: egress-policy: audit @@ -55,7 +55,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 with: egress-policy: audit From 735008bafb48017c0d072c12471e1bdcafe5d96d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 14 Sep 2024 10:29:47 +0200 Subject: [PATCH 02/14] chore(deps): update github/codeql-action action to v3.26.7 (#732) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github/codeql-action](https://redirect.github.com/github/codeql-action) | action | patch | `v3.26.6` -> `v3.26.7` | --- ### Release Notes
github/codeql-action (github/codeql-action) ### [`v3.26.7`](https://redirect.github.com/github/codeql-action/compare/v3.26.6...v3.26.7) [Compare Source](https://redirect.github.com/github/codeql-action/compare/v3.26.6...v3.26.7)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/xmldom/xmldom). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql.yml | 6 +++--- .github/workflows/scorecard.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3f226f149..488d99e19 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -38,7 +38,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/init@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -52,7 +52,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/autobuild@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 # â„šī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -65,6 +65,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/analyze@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index d18a2cccb..266e43f4a 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -72,6 +72,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 with: sarif_file: results.sarif From 60bbeb179f6984f40b0f8f6424fd62db1fe927cf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 14 Sep 2024 14:04:52 +0200 Subject: [PATCH 03/14] chore(deps): update step-security/harden-runner action to v2.10.1 (#730) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [step-security/harden-runner](https://redirect.github.com/step-security/harden-runner) | action | patch | `v2.10.0` -> `v2.10.1` | --- ### Release Notes
step-security/harden-runner (step-security/harden-runner) ### [`v2.10.1`](https://redirect.github.com/step-security/harden-runner/releases/tag/v2.10.1) [Compare Source](https://redirect.github.com/step-security/harden-runner/compare/v2.10.0...v2.10.1) ##### What's Changed Release v2.10.1 by [@​varunsh-coder](https://redirect.github.com/varunsh-coder) in [https://github.com/step-security/harden-runner/pull/463](https://redirect.github.com/step-security/harden-runner/pull/463) Bug fix: Resolves an issue where DNS resolution of .local domains was failing when using a Kind cluster in a GitHub Actions workflow. **Full Changelog**: https://github.com/step-security/harden-runner/compare/v2...v2.10.1
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/xmldom/xmldom). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/dependency-review.yml | 2 +- .github/workflows/examples.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- .github/workflows/test-node.js.yml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 3f8d3f09d..c1209291a 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index d74cc8f93..e0664eae4 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -26,7 +26,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit @@ -59,7 +59,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 266e43f4a..f4e44c3b5 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -32,7 +32,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit diff --git a/.github/workflows/test-node.js.yml b/.github/workflows/test-node.js.yml index 7c01784c4..49e5605a4 100644 --- a/.github/workflows/test-node.js.yml +++ b/.github/workflows/test-node.js.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit @@ -55,7 +55,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858 # v2.10.0 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: audit From 7739150f810183389a6df8feca79b1fc086c9aed Mon Sep 17 00:00:00 2001 From: Christian Bewernitz Date: Sat, 14 Sep 2024 22:37:21 +0200 Subject: [PATCH 04/14] fix: restore more Node and ProcessingInstruction types (#726) - `Node.nodeType` - `Node.textContent` - `Node.columnNumber` - `Node.lineNumber` - `ProcessingInstruction.data` (inherited from `CharacterData`) - `ProcessingInstruction.target` fixes #725 --- examples/typescript-node-es6/src/index.ts | 18 ++++++++++ index.d.ts | 43 ++++++++++++++++++----- lib/dom.js | 15 ++++---- 3 files changed, 60 insertions(+), 16 deletions(-) diff --git a/examples/typescript-node-es6/src/index.ts b/examples/typescript-node-es6/src/index.ts index b4e3a03a1..f2e2d6278 100644 --- a/examples/typescript-node-es6/src/index.ts +++ b/examples/typescript-node-es6/src/index.ts @@ -24,6 +24,7 @@ import { Text, XMLSerializer, Element, + ProcessingInstruction, } from '@xmldom/xmldom'; const failedAssertions: Error[] = []; @@ -75,6 +76,14 @@ new ParseError('message', {}, domException); assert(Node.ATTRIBUTE_NODE, 2); assert(Node.DOCUMENT_POSITION_CONTAINS, 8); +// there are no real Node instances, +// but we want to check that the Node type provides these props +const fakeNode = {} as unknown as Node; +assert(fakeNode.nodeType, undefined); +assert(fakeNode.lineNumber, undefined); +assert(fakeNode.columnNumber, undefined); +assert(fakeNode.textContent, undefined); + assert(new NodeList().length, 0); const impl = new DOMImplementation(); @@ -101,6 +110,15 @@ assert(element.nodeType, Node.ELEMENT_NODE); assert(element.ownerDocument, doc1); assert(element.attributes instanceof NamedNodeMap, true); +const pi = doc1.createProcessingInstruction('target', 'data'); +assert(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE); +assert(pi.target, 'target'); +assert(pi.data, 'data'); +assert(pi.target, pi.nodeName); +assert(pi.data, pi.nodeValue); +assert(pi instanceof ProcessingInstruction, true); +assert(pi instanceof CharacterData, true); + const cdata = doc1.createCDATASection('< &'); assert(cdata instanceof CharacterData, true); assert(cdata instanceof CDATASection, true); diff --git a/index.d.ts b/index.d.ts index 643a35aa2..fee27d17b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -350,7 +350,7 @@ declare module '@xmldom/xmldom' { * cannot have children will throw an exception. * * **This behavior is slightly different from the in the specs**: - * - undeclared properties: nodeType, baseURI, isConnected, parentElement, textContent + * - undeclared properties: baseURI, isConnected, parentElement * - missing methods: contains, getRootNode, isEqualNode, isSameNode * * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 @@ -396,6 +396,12 @@ declare module '@xmldom/xmldom' { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeName) */ readonly nodeName: string; + /** + * Returns the type of node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeType) + */ + readonly nodeType: number; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeValue) */ nodeValue: string | null; /** @@ -420,6 +426,19 @@ declare module '@xmldom/xmldom' { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/previousSibling) */ readonly previousSibling: Node | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/textContent) */ + textContent: string | null; + + /** + * Zero based line position inside the parsed source, + * if the `locator` was not disabled. + */ + lineNumber?: number; + /** + * One based column position inside the parsed source, + * if the `locator` was not disabled. + */ + columnNumber?: number; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/appendChild) */ appendChild(node: Node): Node; @@ -956,12 +975,7 @@ declare module '@xmldom/xmldom' { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData) */ - var CharacterData: { - // instanceof pre ts 5.3 - (val: unknown): val is CharacterData; - // instanceof post ts 5.3 - [Symbol.hasInstance](val: unknown): val is CharacterData; - }; + var CharacterData: InstanceOf; /** * The textual content of Element or Attr. If an element has no markup within its content, it has @@ -1059,8 +1073,20 @@ declare module '@xmldom/xmldom' { } var Notation: InstanceOf; - interface ProcessingInstruction extends Node { + interface ProcessingInstruction extends CharacterData { nodeType: typeof Node.PROCESSING_INSTRUCTION_NODE; + /** + * A string representing the textual data contained in this object. + * For `ProcessingInstruction`, that means everything that goes after the `target`, excluding + * `?>`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/data) + */ + data: string; + /** + * A string containing the name of the application. + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ProcessingInstruction/target) */ + readonly target: string; } var ProcessingInstruction: InstanceOf; @@ -1368,7 +1394,6 @@ declare module '@xmldom/xmldom' { class XMLSerializer { serializeToString(node: Node, nodeFilter?: (node: Node) => boolean): string; } - // END ./lib/dom.js // START ./lib/dom-parser.js diff --git a/lib/dom.js b/lib/dom.js index 135b70cb3..7bc7ae9b5 100644 --- a/lib/dom.js +++ b/lib/dom.js @@ -979,7 +979,7 @@ DOMImplementation.prototype = { * cannot have children will throw an exception. * * **This behavior is slightly different from the in the specs**: - * - undeclared properties: nodeType, baseURI, isConnected, parentElement, textContent + * - undeclared properties: baseURI, isConnected, parentElement * - missing methods: contains, getRootNode, isEqualNode, isSameNode * * @class @@ -1587,12 +1587,13 @@ function hasValidParentNodeType(node) { function hasInsertableNodeType(node) { return ( node && - (isElementNode(node) || - node instanceof CharacterData || - isDocTypeNode(node) || - node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || + (node.nodeType === Node.CDATA_SECTION_NODE || node.nodeType === Node.COMMENT_NODE || - node.nodeType === Node.PROCESSING_INSTRUCTION_NODE) + node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || + node.nodeType === Node.DOCUMENT_TYPE_NODE || + node.nodeType === Node.ELEMENT_NODE || + node.nodeType === Node.PROCESSING_INSTRUCTION_NODE || + node.nodeType === Node.TEXT_NODE) ); } @@ -2481,7 +2482,7 @@ function ProcessingInstruction(symbol) { checkSymbol(symbol); } ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE; -_extends(ProcessingInstruction, Node); +_extends(ProcessingInstruction, CharacterData); function XMLSerializer() {} XMLSerializer.prototype.serializeToString = function (node, nodeFilter) { return nodeSerializeToString.call(node, nodeFilter); From 7f506e7c66245cd9ef7bba632657b6b0f76a9e1d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 15 Sep 2024 05:25:43 +0200 Subject: [PATCH 05/14] chore(deps): update dependency auto-changelog to v2.5.0 (#733) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [auto-changelog](https://redirect.github.com/CookPete/auto-changelog) | [`2.4.0` -> `2.5.0`](https://renovatebot.com/diffs/npm/auto-changelog/2.4.0/2.5.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/auto-changelog/2.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/auto-changelog/2.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/auto-changelog/2.4.0/2.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/auto-changelog/2.4.0/2.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
CookPete/auto-changelog (auto-changelog) ### [`v2.5.0`](https://redirect.github.com/CookPete/auto-changelog/blob/HEAD/CHANGELOG.md#v250) [Compare Source](https://redirect.github.com/CookPete/auto-changelog/compare/v2.4.0...v2.5.0) - Fix: Throws error if tag does not contains "version" property [`#272`](https://redirect.github.com/cookpete/auto-changelog/pull/272) - Add support for GitLab's new style routes [`#267`](https://redirect.github.com/cookpete/auto-changelog/pull/267) - fix: gitlab subgroups [`#232`](https://redirect.github.com/cookpete/auto-changelog/pull/232) - Add Template for handling commits with Conventional Commits format [`#217`](https://redirect.github.com/cookpete/auto-changelog/pull/217) - upgrade parse-github-url v1.0.3 [`#289`](https://redirect.github.com/cookpete/auto-changelog/pull/289) - tests: fix parseReleases [`#265`](https://redirect.github.com/cookpete/auto-changelog/pull/265) - feat: combine multiple commit-lists to one if heading is undefined [`#236`](https://redirect.github.com/cookpete/auto-changelog/pull/236) - Add a Plugin system [`#237`](https://redirect.github.com/cookpete/auto-changelog/pull/237) - add support for including commit pattern [`#258`](https://redirect.github.com/cookpete/auto-changelog/pull/258) - Revert GitLab's new style routes [`b087f51`](https://redirect.github.com/cookpete/auto-changelog/commit/b087f51151955f6f62ed1fcee9d3e144c9ed931a) - Remove email from package.json [`0991f17`](https://redirect.github.com/cookpete/auto-changelog/commit/0991f17ce936a9db490e2ad1a04121755038b78d)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/xmldom/xmldom). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package-lock.json | 93 +++++++++++++++++++++++++++++++++++++++-------- package.json | 2 +- 2 files changed, 78 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index caa9da061..20bd8878c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@homer0/prettier-plugin-jsdoc": "9.0.2", "@jazzer.js/core": "2.1.0", "@jazzer.js/jest-runner": "2.1.0", - "auto-changelog": "2.4.0", + "auto-changelog": "2.5.0", "eslint": "8.57.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-anti-trojan-source": "1.1.1", @@ -2108,15 +2108,16 @@ "dev": true }, "node_modules/auto-changelog": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.4.0.tgz", - "integrity": "sha512-vh17hko1c0ItsEcw6m7qPRf3m45u+XK5QyCrrBFViElZ8jnKrPC1roSznrd1fIB/0vR/zawdECCRJtTuqIXaJw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.5.0.tgz", + "integrity": "sha512-UTnLjT7I9U2U/xkCUH5buDlp8C7g0SGChfib+iDrJkamcj5kaMqNKHNfbKJw1kthJUq8sUo3i3q2S6FzO/l/wA==", "dev": true, "dependencies": { "commander": "^7.2.0", "handlebars": "^4.7.7", + "import-cwd": "^3.0.0", "node-fetch": "^2.6.1", - "parse-github-url": "^1.0.2", + "parse-github-url": "^1.0.3", "semver": "^7.3.5" }, "bin": { @@ -5084,6 +5085,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/import-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-3.0.0.tgz", + "integrity": "sha512-4pnzH16plW+hgvRECbDWpQl3cqtvSofHWh44met7ESfZ8UZOWWddm8hEyDTqREJ9RbYHY8gi8DqmaelApoOGMg==", + "dev": true, + "dependencies": { + "import-from": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -5100,6 +5113,27 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/import-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/import-from/-/import-from-3.0.0.tgz", + "integrity": "sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-from/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/import-lazy": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", @@ -8714,15 +8748,15 @@ } }, "node_modules/parse-github-url": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.2.tgz", - "integrity": "sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.3.tgz", + "integrity": "sha512-tfalY5/4SqGaV/GIGzWyHnFjlpTPTNpENR9Ea2lLldSJ8EWXMsvacWucqY3m3I4YPtas15IxTLQVQ5NSYXPrww==", "dev": true, "bin": { "parse-github-url": "cli.js" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.10" } }, "node_modules/parse-json": { @@ -12259,15 +12293,16 @@ "dev": true }, "auto-changelog": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.4.0.tgz", - "integrity": "sha512-vh17hko1c0ItsEcw6m7qPRf3m45u+XK5QyCrrBFViElZ8jnKrPC1roSznrd1fIB/0vR/zawdECCRJtTuqIXaJw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.5.0.tgz", + "integrity": "sha512-UTnLjT7I9U2U/xkCUH5buDlp8C7g0SGChfib+iDrJkamcj5kaMqNKHNfbKJw1kthJUq8sUo3i3q2S6FzO/l/wA==", "dev": true, "requires": { "commander": "^7.2.0", "handlebars": "^4.7.7", + "import-cwd": "^3.0.0", "node-fetch": "^2.6.1", - "parse-github-url": "^1.0.2", + "parse-github-url": "^1.0.3", "semver": "^7.3.5" }, "dependencies": { @@ -14339,6 +14374,15 @@ } } }, + "import-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-3.0.0.tgz", + "integrity": "sha512-4pnzH16plW+hgvRECbDWpQl3cqtvSofHWh44met7ESfZ8UZOWWddm8hEyDTqREJ9RbYHY8gi8DqmaelApoOGMg==", + "dev": true, + "requires": { + "import-from": "^3.0.0" + } + }, "import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -14349,6 +14393,23 @@ "resolve-from": "^4.0.0" } }, + "import-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/import-from/-/import-from-3.0.0.tgz", + "integrity": "sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, "import-lazy": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", @@ -16977,9 +17038,9 @@ } }, "parse-github-url": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.2.tgz", - "integrity": "sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.3.tgz", + "integrity": "sha512-tfalY5/4SqGaV/GIGzWyHnFjlpTPTNpENR9Ea2lLldSJ8EWXMsvacWucqY3m3I4YPtas15IxTLQVQ5NSYXPrww==", "dev": true }, "parse-json": { diff --git a/package.json b/package.json index 76f8c3bbd..71873e48d 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@homer0/prettier-plugin-jsdoc": "9.0.2", "@jazzer.js/core": "2.1.0", "@jazzer.js/jest-runner": "2.1.0", - "auto-changelog": "2.4.0", + "auto-changelog": "2.5.0", "eslint": "8.57.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-anti-trojan-source": "1.1.1", From ff1590245712d449fd7f487209597126b9d9c8cb Mon Sep 17 00:00:00 2001 From: Christian Bewernitz Date: Sun, 15 Sep 2024 18:39:33 +0200 Subject: [PATCH 06/14] fix: `getElements*` methods return `LiveNodeList` (#734) - NodeList and LiveNodeList are now generic, with a default of `Node` when no type argument is passed. - `Node.getElements*` and `Document.getElements*` return `LiveNodeList` - `NodeList[number]` is now typed as `T` instead of `T | undefined`, which of course only works for indexes < `length` Fixes #731 --- examples/typescript-node-es6/src/index.ts | 5 ++ examples/typescript-node-es6/tsconfig.json | 4 +- index.d.ts | 75 ++++++---------------- 3 files changed, 27 insertions(+), 57 deletions(-) diff --git a/examples/typescript-node-es6/src/index.ts b/examples/typescript-node-es6/src/index.ts index f2e2d6278..0a6da54e4 100644 --- a/examples/typescript-node-es6/src/index.ts +++ b/examples/typescript-node-es6/src/index.ts @@ -98,6 +98,11 @@ assert(doc1.childNodes instanceof NodeList, true); assert(doc1.documentElement instanceof Element, true); assert(doc1.documentElement?.tagName, 'qualifiedName'); assert(doc1.getElementsByClassName('hide') instanceof LiveNodeList, true); +Array.from(doc1.getElementsByTagName('img')).find( + // just a type check, since the document doesn't contain any img elements, + // this method will never be executed, but typescript checks need to pass + (element) => assert(element instanceof Element, true) +); const attr = doc1.createAttribute('attr'); assert(attr.nodeType, Node.ATTRIBUTE_NODE); diff --git a/examples/typescript-node-es6/tsconfig.json b/examples/typescript-node-es6/tsconfig.json index 1c747f619..41a9fc601 100644 --- a/examples/typescript-node-es6/tsconfig.json +++ b/examples/typescript-node-es6/tsconfig.json @@ -11,9 +11,9 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "es5" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + "target": "es6" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, "lib": [ - "ES5" + "ES6" ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ diff --git a/index.d.ts b/index.d.ts index fee27d17b..abbd52c52 100644 --- a/index.d.ts +++ b/index.d.ts @@ -637,23 +637,12 @@ declare module '@xmldom/xmldom' { * Get an attribute by name. Note: Name is in lower case in case of HTML namespace and * document. * - * @param {string} localName - * The local name of the attribute. - * @returns {Attr | null} - * The attribute with the given local name, or null if no such attribute exists. * @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name */ getNamedItem(qualifiedName: string): Attr | null; /** * Get an attribute by namespace and local name. * - * @param {string | null} namespaceURI - * The namespace URI of the attribute. - * @param {string} localName - * The local name of the attribute. - * @returns {Attr | null} - * The attribute with the given namespace URI and local name, or null if no such attribute - * exists. * @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace */ getNamedItemNS(namespace: string | null, localName: string): Attr | null; @@ -663,10 +652,6 @@ declare module '@xmldom/xmldom' { /** * Removes an attribute specified by the local name. * - * @param {string} localName - * The local name of the attribute to be removed. - * @returns {Attr} - * The attribute node that was removed. * @throws {DOMException} * With code: * - {@link DOMException.NOT_FOUND_ERR} if no attribute with the given name is found. @@ -677,12 +662,6 @@ declare module '@xmldom/xmldom' { /** * Removes an attribute specified by the namespace and local name. * - * @param {string | null} namespaceURI - * The namespace URI of the attribute to be removed. - * @param {string} localName - * The local name of the attribute to be removed. - * @returns {Attr} - * The attribute node that was removed. * @throws {DOMException} * With code: * - {@link DOMException.NOT_FOUND_ERR} if no attribute with the given namespace URI and @@ -694,11 +673,6 @@ declare module '@xmldom/xmldom' { /** * Set an attribute. * - * @param {Attr} attr - * The attribute to set. - * @returns {Attr | null} - * The old attribute with the same local name and namespace URI as the new one, or null if no - * such attribute exists. * @throws {DOMException} * With code: * - {@link INUSE_ATTRIBUTE_ERR} - If the attribute is already an attribute of another @@ -710,11 +684,6 @@ declare module '@xmldom/xmldom' { * Set an attribute, replacing an existing attribute with the same local name and namespace * URI if one exists. * - * @param {Attr} attr - * The attribute to set. - * @returns {Attr | null} - * The old attribute with the same local name and namespace URI as the new one, or null if no - * such attribute exists. * @throws {DOMException} * Throws a DOMException with the name "InUseAttributeError" if the attribute is already an * attribute of another element. @@ -731,7 +700,7 @@ declare module '@xmldom/xmldom' { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/NodeList) */ - class NodeList implements Iterable { + class NodeList implements Iterable { /** * Returns the number of nodes in the collection. * @@ -743,34 +712,40 @@ declare module '@xmldom/xmldom' { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/NodeList/item) */ - item(index: number): Node | null; + item(index: number): T | null; /** * Returns a string representation of the NodeList. */ - toString(nodeFilter: (node: Node) => Node | undefined): string; + toString(nodeFilter: (node: T) => T | undefined): string; /** * Filters the NodeList based on a predicate. * * @private */ - filter(predicate: (node: Node) => boolean): Node[]; + filter(predicate: (node: T) => boolean): T[]; /** * Returns the first index at which a given node can be found in the NodeList, or -1 if it is * not present. * * @private */ - indexOf(node: Node): number; - [index: number]: Node | undefined; + indexOf(node: T): number; - [Symbol.iterator](): Iterator; + /** + * Index based access returns `undefined`, when accessing indexes >= `length`. + * But it would break a lot of code (like `Array.from` usages), + * if it would be typed as `T | undefined`. + */ + [index: number]: T; + + [Symbol.iterator](): Iterator; } /** * Represents a live collection of nodes that is automatically updated when its associated * document changes. */ - interface LiveNodeList extends NodeList {} + interface LiveNodeList extends NodeList {} /** * Represents a live collection of nodes that is automatically updated when its associated * document changes. @@ -838,7 +813,7 @@ declare module '@xmldom/xmldom' { * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname */ - getElementsByClassName(classNames: string): LiveNodeList; + getElementsByClassName(classNames: string): LiveNodeList; /** * Returns a LiveNodeList of elements with the given qualifiedName. @@ -862,7 +837,7 @@ declare module '@xmldom/xmldom' { * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName * @see https://dom.spec.whatwg.org/#concept-getelementsbytagname */ - getElementsByTagName(qualifiedName: string): LiveNodeList; + getElementsByTagName(qualifiedName: string): LiveNodeList; /** * Returns a `LiveNodeList` of elements with the given tag name belonging to the given @@ -874,7 +849,7 @@ declare module '@xmldom/xmldom' { getElementsByTagNameNS( namespaceURI: string | null, localName: string - ): LiveNodeList; + ): LiveNodeList; getQualifiedName(): string; /** @@ -1107,7 +1082,6 @@ declare module '@xmldom/xmldom' { /** * The implementation that created this document. * - * @type DOMImplementation * @readonly */ readonly implementation: DOMImplementation; @@ -1125,9 +1099,6 @@ declare module '@xmldom/xmldom' { /** * Creates an attribute object with a specified name. * - * @param name - * String that sets the attribute object's name. - * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createAttribute) */ createAttribute(localName: string): Attr; @@ -1145,9 +1116,6 @@ declare module '@xmldom/xmldom' { /** * Creates a comment object with the specified data. * - * @param data - * Sets the comment object's data. - * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createComment) */ createComment(data: string): Comment; @@ -1208,9 +1176,6 @@ declare module '@xmldom/xmldom' { /** * Returns a reference to the first object with the specified value of the ID attribute. - * - * @param elementId - * String that specifies the ID value. */ getElementById(elementId: string): Element | null; @@ -1229,7 +1194,7 @@ declare module '@xmldom/xmldom' { * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname */ - getElementsByClassName(classNames: string): LiveNodeList; + getElementsByClassName(classNames: string): LiveNodeList; /** * Returns a LiveNodeList of elements with the given qualifiedName. @@ -1253,7 +1218,7 @@ declare module '@xmldom/xmldom' { * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName * @see https://dom.spec.whatwg.org/#concept-getelementsbytagname */ - getElementsByTagName(qualifiedName: string): LiveNodeList; + getElementsByTagName(qualifiedName: string): LiveNodeList; /** * Returns a `LiveNodeList` of elements with the given tag name belonging to the given @@ -1268,7 +1233,7 @@ declare module '@xmldom/xmldom' { getElementsByTagNameNS( namespaceURI: string | null, localName: string - ): LiveNodeList; + ): LiveNodeList; /** * Returns a copy of node. If deep is true, the copy also includes the node's descendants. * From d56c4a2dca3b5ad5afd2f76dd3ee79375b40b0e6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 22:24:46 +0200 Subject: [PATCH 07/14] chore(deps): update dependency eslint to v8.57.1 (#737) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [eslint](https://eslint.org) ([source](https://redirect.github.com/eslint/eslint)) | [`8.57.0` -> `8.57.1`](https://renovatebot.com/diffs/npm/eslint/8.57.0/8.57.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/eslint/8.57.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/eslint/8.57.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/eslint/8.57.0/8.57.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/eslint/8.57.0/8.57.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
eslint/eslint (eslint) ### [`v8.57.1`](https://redirect.github.com/eslint/eslint/compare/v8.57.0...5b9414c501c58bfa85f41f96f821973c41e8ae74) [Compare Source](https://redirect.github.com/eslint/eslint/compare/v8.57.0...v8.57.1)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/xmldom/xmldom). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package-lock.json | 64 ++++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/package-lock.json b/package-lock.json index 20bd8878c..505cbc3e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@jazzer.js/core": "2.1.0", "@jazzer.js/jest-runner": "2.1.0", "auto-changelog": "2.5.0", - "eslint": "8.57.0", + "eslint": "8.57.1", "eslint-config-prettier": "9.1.0", "eslint-plugin-anti-trojan-source": "1.1.1", "eslint-plugin-es5": "1.5.0", @@ -730,9 +730,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", - "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -753,12 +753,13 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^2.0.2", + "@humanwhocodes/object-schema": "^2.0.3", "debug": "^4.3.1", "minimatch": "^3.0.5" }, @@ -780,9 +781,10 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", - "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", "dev": true }, "node_modules/@istanbuljs/load-nyc-config": { @@ -3841,16 +3843,16 @@ } }, "node_modules/eslint": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", - "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.0", - "@humanwhocodes/config-array": "^0.11.14", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", @@ -11238,9 +11240,9 @@ } }, "@eslint/js": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", - "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", "dev": true }, "@homer0/prettier-plugin-jsdoc": { @@ -11255,12 +11257,12 @@ } }, "@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", "dev": true, "requires": { - "@humanwhocodes/object-schema": "^2.0.2", + "@humanwhocodes/object-schema": "^2.0.3", "debug": "^4.3.1", "minimatch": "^3.0.5" } @@ -11272,9 +11274,9 @@ "dev": true }, "@humanwhocodes/object-schema": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", - "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "dev": true }, "@istanbuljs/load-nyc-config": { @@ -13493,16 +13495,16 @@ "dev": true }, "eslint": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", - "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.0", - "@humanwhocodes/config-array": "^0.11.14", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", diff --git a/package.json b/package.json index 71873e48d..a4d132e67 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@jazzer.js/core": "2.1.0", "@jazzer.js/jest-runner": "2.1.0", "auto-changelog": "2.5.0", - "eslint": "8.57.0", + "eslint": "8.57.1", "eslint-config-prettier": "9.1.0", "eslint-plugin-anti-trojan-source": "1.1.1", "eslint-plugin-es5": "1.5.0", From 4cc5d9a735ce064a41294a6fa29fb614b6c47462 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 20:26:28 +0000 Subject: [PATCH 08/14] chore(deps): update actions/setup-node action to v4.0.4 (#736) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/setup-node](https://redirect.github.com/actions/setup-node) | action | patch | `v4.0.3` -> `v4.0.4` | --- ### Release Notes
actions/setup-node (actions/setup-node) ### [`v4.0.4`](https://redirect.github.com/actions/setup-node/compare/v4.0.3...v4.0.4) [Compare Source](https://redirect.github.com/actions/setup-node/compare/v4.0.3...v4.0.4)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/xmldom/xmldom). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/examples.yml | 4 ++-- .github/workflows/test-node.js.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index e0664eae4..32e79cee3 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: node-version: ${{ matrix.node-version }} - run: npm install @@ -65,7 +65,7 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: node-version: ${{ matrix.node-version }} - run: ./pretest.sh ${{ matrix.ts-version }} diff --git a/.github/workflows/test-node.js.yml b/.github/workflows/test-node.js.yml index 49e5605a4..c39f4be92 100644 --- a/.github/workflows/test-node.js.yml +++ b/.github/workflows/test-node.js.yml @@ -34,7 +34,7 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: node-version: ${{ matrix.node-version }} - run: npm ci --no-audit @@ -60,7 +60,7 @@ jobs: egress-policy: audit - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: node-version-file: .node-version - run: npm ci --no-audit From 8d576bee7d2121d62f78db1d3b064adfe42a0a0e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 20:28:37 +0000 Subject: [PATCH 09/14] chore(deps): update github/codeql-action action to v3.26.8 (#735) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github/codeql-action](https://redirect.github.com/github/codeql-action) | action | patch | `v3.26.7` -> `v3.26.8` | --- ### Release Notes
github/codeql-action (github/codeql-action) ### [`v3.26.8`](https://redirect.github.com/github/codeql-action/compare/v3.26.7...v3.26.8) [Compare Source](https://redirect.github.com/github/codeql-action/compare/v3.26.7...v3.26.8)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/xmldom/xmldom). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql.yml | 6 +++--- .github/workflows/scorecard.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 488d99e19..aba5239fc 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -38,7 +38,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 + uses: github/codeql-action/init@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -52,7 +52,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 + uses: github/codeql-action/autobuild@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 # â„šī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -65,6 +65,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 + uses: github/codeql-action/analyze@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index f4e44c3b5..56e41ed88 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -72,6 +72,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: sarif_file: results.sarif From 301619ee00be5fecf5d7a2d92cace4638d16d67c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2024 20:57:11 +0200 Subject: [PATCH 10/14] chore(deps): update dependency nodemon to v3.1.5 (#738) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [nodemon](https://nodemon.io) ([source](https://redirect.github.com/remy/nodemon)) | [`3.1.4` -> `3.1.5`](https://renovatebot.com/diffs/npm/nodemon/3.1.4/3.1.5) | [![age](https://developer.mend.io/api/mc/badges/age/npm/nodemon/3.1.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/nodemon/3.1.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/nodemon/3.1.4/3.1.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/nodemon/3.1.4/3.1.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
remy/nodemon (nodemon) ### [`v3.1.5`](https://redirect.github.com/remy/nodemon/compare/v3.1.4...254c2ab17877a79b9573c79371cb0fc567eb0514) [Compare Source](https://redirect.github.com/remy/nodemon/compare/v3.1.4...v3.1.5)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/xmldom/xmldom). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package-lock.json | 26 +++++++++++++------------- package.json | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 505cbc3e0..b143cb712 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "eslint-plugin-prettier": "5.2.1", "get-stream": "6.0.1", "jest": "29.7.0", - "nodemon": "3.1.4", + "nodemon": "3.1.5", "np": "8.0.4", "prettier": "3.3.3", "rxjs": "7.8.1", @@ -7711,9 +7711,9 @@ "dev": true }, "node_modules/nodemon": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.4.tgz", - "integrity": "sha512-wjPBbFhtpJwmIeY2yP7QF+UKzPfltVGtfce1g/bB15/8vCGZj8uxD62b/b9M9/WVgme0NZudpownKN+c0plXlQ==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.5.tgz", + "integrity": "sha512-V5UtfYc7hjFD4SI3EzD5TR8ChAHEZ+Ns7Z5fBk8fAbTVAj+q3G+w7sHJrHxXBkVn6ApLVTljau8wfHwqmGUjMw==", "dev": true, "dependencies": { "chokidar": "^3.5.2", @@ -7739,9 +7739,9 @@ } }, "node_modules/nodemon/node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -16354,9 +16354,9 @@ "dev": true }, "nodemon": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.4.tgz", - "integrity": "sha512-wjPBbFhtpJwmIeY2yP7QF+UKzPfltVGtfce1g/bB15/8vCGZj8uxD62b/b9M9/WVgme0NZudpownKN+c0plXlQ==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.5.tgz", + "integrity": "sha512-V5UtfYc7hjFD4SI3EzD5TR8ChAHEZ+Ns7Z5fBk8fAbTVAj+q3G+w7sHJrHxXBkVn6ApLVTljau8wfHwqmGUjMw==", "dev": true, "requires": { "chokidar": "^3.5.2", @@ -16372,9 +16372,9 @@ }, "dependencies": { "semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true } } diff --git a/package.json b/package.json index a4d132e67..f7fab6988 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "eslint-plugin-prettier": "5.2.1", "get-stream": "6.0.1", "jest": "29.7.0", - "nodemon": "3.1.4", + "nodemon": "3.1.5", "np": "8.0.4", "prettier": "3.3.3", "rxjs": "7.8.1", From b06012312560b7083dbe658c6c29953bab4f582b Mon Sep 17 00:00:00 2001 From: Oliver Swienty <68075538+Ponynjaa@users.noreply.github.com> Date: Fri, 20 Sep 2024 21:06:04 +0200 Subject: [PATCH 11/14] feat: Add missing node props (#728) Adds missing properties and methods of Node to be compatible with the default DOM-typings. Added properties `parentElement`, `baseURI`, `isConnected`. Added methods `contains(otherNode)`, `getRootNode(options)`, `isEqualNode(otherNode)`, `isSameNode(otherNode)`. --------- Co-authored-by: Christian Bewernitz --- fuzz/regression.test.js | 1 + index.d.ts | 77 +++++++++++- lib/dom.js | 205 +++++++++++++++++++++++++++++- readme.md | 42 ++++--- test/dom/document.test.js | 23 ++++ test/dom/node.test.js | 259 +++++++++++++++++++++++++++++++++++++- 6 files changed, 579 insertions(+), 28 deletions(-) diff --git a/fuzz/regression.test.js b/fuzz/regression.test.js index c5cd21b59..7370af79f 100644 --- a/fuzz/regression.test.js +++ b/fuzz/regression.test.js @@ -1,4 +1,5 @@ 'use strict'; +// wallaby:file.skip since wallaby is not concerned with fuzz testing const { describe, expect, test, beforeAll } = require('@jest/globals'); const fs = require('fs'); diff --git a/index.d.ts b/index.d.ts index abbd52c52..c31079b79 100644 --- a/index.d.ts +++ b/index.d.ts @@ -333,6 +333,11 @@ declare module '@xmldom/xmldom' { // instanceof post ts 5.3 [Symbol.hasInstance](val: unknown): val is T; }; + + type GetRootNodeOptions = { + composed?: boolean; + }; + /** * The DOM Node interface is an abstract base class upon which many other DOM API objects are * based, thus letting those object types to be used similarly and often interchangeably. As an @@ -350,8 +355,7 @@ declare module '@xmldom/xmldom' { * cannot have children will throw an exception. * * **This behavior is slightly different from the in the specs**: - * - undeclared properties: baseURI, isConnected, parentElement - * - missing methods: contains, getRootNode, isEqualNode, isSameNode + * - unimplemented interfaces: EventTarget * * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 * @see https://dom.spec.whatwg.org/#node @@ -380,6 +384,18 @@ declare module '@xmldom/xmldom' { * The local part of the qualified name of this node. */ localName: string | null; + /** + * Always returns `about:blank` currently. + * + * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI) + */ + readonly baseURI: 'about:blank'; + /** + * Returns true if this node is inside of a document or is the document node itself. + * + * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) + */ + readonly isConnected: boolean; /** * The namespace URI of this node. */ @@ -416,6 +432,12 @@ declare module '@xmldom/xmldom' { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/parentNode) */ readonly parentNode: Node | null; + /** + * Returns the parent `Node` if it is of type `Element`, otherwise `null`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/parentElement) + */ + readonly parentElement: Element | null; /** * The prefix of the namespace for this node. */ @@ -443,6 +465,40 @@ declare module '@xmldom/xmldom' { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/appendChild) */ appendChild(node: Node): Node; + /** + * Checks whether `other` is an inclusive descendant of this node. + * + * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/contains) + */ + contains(other: Node | null | undefined): boolean; + /** + * Searches for the root node of this node. + * + * **This behavior is slightly different from the one in the specs**: + * - ignores `options.composed`, since `ShadowRoot`s are unsupported, therefore always + * returning root. + * + * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode) + * + * @see https://dom.spec.whatwg.org/#dom-node-getrootnode + * @see https://dom.spec.whatwg.org/#concept-shadow-including-root + */ + getRootNode(options: GetRootNodeOptions): Node; + + /** + * Checks whether the given node is equal to this node. + * + * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/isEqualNode) + */ + isEqualNode(other: Node): boolean; + + /** + * Checks whether the given node is this node. + * + * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/isSameNode) + */ + isSameNode(other: Node): boolean; + /** * Returns a copy of node. If deep is true, the copy also includes the node's descendants. * @@ -1150,6 +1206,23 @@ declare module '@xmldom/xmldom' { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElementNS) */ createElementNS(namespace: string | null, qualifiedName: string): Element; + /** + * Creates an EntityReference object. + * The current implementation does not fill the `childNodes` with those of the corresponding + * `Entity` + * + * The name of the entity to reference. No namespace well-formedness checks are performed. + * + * @deprecated + * In DOM Level 4. + * @returns {EntityReference} + * @throws {DOMException} + * With code `INVALID_CHARACTER_ERR` when `name` is not valid. + * @throws {DOMException} + * with code `NOT_SUPPORTED_ERR` when the document is of type `html` + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE + */ + createEntityReference(name: string): EntityReference; /** * Returns a ProcessingInstruction node whose target is target and data is data. If target does diff --git a/lib/dom.js b/lib/dom.js index 7bc7ae9b5..a25a56748 100644 --- a/lib/dom.js +++ b/lib/dom.js @@ -22,6 +22,7 @@ var PDC = Symbol(); var errors = require('./errors'); var DOMException = errors.DOMException; +var DOMExceptionName = errors.DOMExceptionName; var g = require('./grammar'); @@ -870,7 +871,7 @@ DOMImplementation.prototype = { * Creates an empty DocumentType node. Entity declarations and notations are not made * available. Entity reference expansions and default attribute additions do not occur. * - * **This behavior is slightly different from the in the specs**: + * **This behavior is slightly different from the one in the specs**: * - `encoding`, `mode`, `origin`, `url` fields are currently not declared. * - `publicId` and `systemId` contain the raw data including any possible quotes, * so they can always be serialized back to the original value @@ -919,6 +920,7 @@ DOMImplementation.prototype = { node.publicId = publicId || ''; node.systemId = systemId || ''; node.internalSubset = internalSubset || ''; + node.childNodes = new NodeList(); return node; }, @@ -979,8 +981,7 @@ DOMImplementation.prototype = { * cannot have children will throw an exception. * * **This behavior is slightly different from the in the specs**: - * - undeclared properties: baseURI, isConnected, parentElement - * - missing methods: contains, getRootNode, isEqualNode, isSameNode + * - unimplemented interfaces: `EventTarget` * * @class * @abstract @@ -1024,10 +1025,18 @@ Node.prototype = { * @type {Node | null} */ parentNode: null, + /** + * The parent element of this node. + * + * @type {Element | null} + */ + get parentElement() { + return this.parentNode && this.parentNode.nodeType === this.ELEMENT_NODE ? this.parentNode : null; + }, /** * The child nodes of this node. * - * @type {NodeList | null} + * @type {NodeList} */ childNodes: null, /** @@ -1060,6 +1069,131 @@ Node.prototype = { * @type {string | null} */ localName: null, + /** + * The baseURI is currently always `about:blank`, + * since that's what happens when you create a document from scratch. + * + * @type {'about:blank'} + */ + baseURI: 'about:blank', + /** + * Is true if this node is part of a document. + * + * @type {boolean} + */ + get isConnected() { + var rootNode = this.getRootNode(); + return rootNode && rootNode.nodeType === rootNode.DOCUMENT_NODE; + }, + /** + * Checks whether `other` is an inclusive descendant of this node. + * + * @param {Node | null | undefined} other + * The node to check. + * @returns {boolean} + * True if `other` is an inclusive descendant of this node; false otherwise. + * @see https://dom.spec.whatwg.org/#dom-node-contains + */ + contains: function (other) { + if (!other) return false; + var parent = other; + do { + if (this === parent) return true; + parent = other.parentNode; + } while (parent); + return false; + }, + /** + * @typedef GetRootNodeOptions + * @property {boolean} [composed=false] + */ + /** + * Searches for the root node of this node. + * + * **This behavior is slightly different from the in the specs**: + * - ignores `options.composed`, since `ShadowRoot`s are unsupported, always returns root. + * + * @param {GetRootNodeOptions} [options] + * @returns {Node} + * Root node. + * @see https://dom.spec.whatwg.org/#dom-node-getrootnode + * @see https://dom.spec.whatwg.org/#concept-shadow-including-root + */ + getRootNode: function (options) { + var parent = this; + do { + if (!parent.parentNode) { + return parent; + } + parent = parent.parentNode; + } while (parent); + }, + /** + * Checks whether the given node is equal to this node. + * + * @param {Node} [otherNode] + * @see https://dom.spec.whatwg.org/#concept-node-equals + */ + isEqualNode: function (otherNode) { + if (!otherNode) return false; + + if (this.nodeType !== otherNode.nodeType) return false; + + switch (this.nodeType) { + case this.DOCUMENT_TYPE_NODE: + if (this.name !== otherNode.name) return false; + if (this.publicId !== otherNode.publicId) return false; + if (this.systemId !== otherNode.systemId) return false; + break; + case this.ELEMENT_NODE: + if (this.namespaceURI !== otherNode.namespaceURI) return false; + if (this.prefix !== otherNode.prefix) return false; + if (this.localName !== otherNode.localName) return false; + if (this.attributes.length !== otherNode.attributes.length) return false; + for (var i = 0; i < this.attributes.length; i++) { + var attr = this.attributes.item(i); + if (!attr.isEqualNode(otherNode.getAttributeNodeNS(attr.namespaceURI, attr.localName))) { + return false; + } + } + break; + case this.ATTRIBUTE_NODE: + if (this.namespaceURI !== otherNode.namespaceURI) return false; + if (this.localName !== otherNode.localName) return false; + if (this.value !== otherNode.value) return false; + + break; + case this.PROCESSING_INSTRUCTION_NODE: + if (this.target !== otherNode.target || this.data !== otherNode.data) { + return false; + } + break; + case this.TEXT_NODE: + case this.COMMENT_NODE: + if (this.data !== otherNode.data) return false; + break; + } + + if (this.childNodes.length !== otherNode.childNodes.length) { + return false; + } + + for (var i = 0; i < this.childNodes.length; i++) { + if (!this.childNodes[i].isEqualNode(otherNode.childNodes[i])) { + return false; + } + } + + return true; + }, + /** + * Checks whether or not the given node is this node. + * + * @param {Node} [otherNode] + */ + isSameNode: function (otherNode) { + return this === otherNode; + }, /** * Inserts a node before a reference node as a child of this node. * @@ -1545,7 +1679,6 @@ function _removeChild(parentNode, child) { if (parentNode !== child.parentNode) { throw new DOMException(DOMException.NOT_FOUND_ERR, "child's parent is not parent"); } - //var index = parentNode.childNodes. var oldPreviousSibling = child.previousSibling; var oldNextSibling = child.nextSibling; if (oldPreviousSibling) { @@ -1922,10 +2055,10 @@ function _insertBefore(parent, node, child, _inDocumentAssertion) { newFirst.parentNode = parent; } while (newFirst !== newLast && (newFirst = newFirst.nextSibling)); _onUpdateChild(parent.ownerDocument || parent, parent); - //console.log(parent.lastChild.nextSibling == null) if (node.nodeType == DOCUMENT_FRAGMENT_NODE) { node.firstChild = node.lastChild = null; } + return node; } @@ -2039,33 +2172,57 @@ Document.prototype = { attrs._ownerElement = node; return node; }, + /** + * @returns {DocumentFragment} + */ createDocumentFragment: function () { var node = new DocumentFragment(PDC); node.ownerDocument = this; node.childNodes = new NodeList(); return node; }, + /** + * @param {string} data + * @returns {Text} + */ createTextNode: function (data) { var node = new Text(PDC); node.ownerDocument = this; + node.childNodes = new NodeList(); node.appendData(data); return node; }, + /** + * @param {string} data + * @returns {Comment} + */ createComment: function (data) { var node = new Comment(PDC); node.ownerDocument = this; + node.childNodes = new NodeList(); node.appendData(data); return node; }, + /** + * @param {string} data + * @returns {CDATASection} + */ createCDATASection: function (data) { var node = new CDATASection(PDC); node.ownerDocument = this; + node.childNodes = new NodeList(); node.appendData(data); return node; }, + /** + * @param {string} target + * @param {string} data + * @returns {ProcessingInstruction} + */ createProcessingInstruction: function (target, data) { var node = new ProcessingInstruction(PDC); node.ownerDocument = this; + node.childNodes = new NodeList(); node.nodeName = node.target = target; node.nodeValue = node.data = data; return node; @@ -2096,19 +2253,49 @@ Document.prototype = { _createAttribute: function (name) { var node = new Attr(PDC); node.ownerDocument = this; + node.childNodes = new NodeList(); node.name = name; node.nodeName = name; node.localName = name; node.specified = true; return node; }, + /** + * Creates an EntityReference object. + * The current implementation does not fill the `childNodes` with those of the corresponding + * `Entity` + * + * @deprecated + * In DOM Level 4. + * @param {string} name + * The name of the entity to reference. No namespace well-formedness checks are performed. + * @returns {EntityReference} + * @throws {DOMException} + * With code `INVALID_CHARACTER_ERR` when `name` is not valid. + * @throws {DOMException} + * with code `NOT_SUPPORTED_ERR` when the document is of type `html` + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE + */ createEntityReference: function (name) { + if (!g.Name.test(name)) { + throw new DOMException(DOMException.INVALID_CHARACTER_ERR, 'not a valid xml name "' + name + '"'); + } + if (this.type === 'html') { + throw new DOMException('document is an html document', DOMExceptionName.NotSupportedError); + } + var node = new EntityReference(PDC); node.ownerDocument = this; + node.childNodes = new NodeList(); node.nodeName = name; return node; }, // Introduced in DOM Level 2: + /** + * @param {string} namespaceURI + * @param {string} qualifiedName + * @returns {Element} + */ createElementNS: function (namespaceURI, qualifiedName) { var validated = validateAndExtract(namespaceURI, qualifiedName); var node = new Element(PDC); @@ -2124,10 +2311,16 @@ Document.prototype = { return node; }, // Introduced in DOM Level 2: + /** + * @param {string} namespaceURI + * @param {string} qualifiedName + * @returns {Attr} + */ createAttributeNS: function (namespaceURI, qualifiedName) { var validated = validateAndExtract(namespaceURI, qualifiedName); var node = new Attr(PDC); node.ownerDocument = this; + node.childNodes = new NodeList(); node.nodeName = qualifiedName; node.name = qualifiedName; node.specified = true; diff --git a/readme.md b/readme.md index ce1f8d022..1496c9e9c 100644 --- a/readme.md +++ b/readme.md @@ -99,7 +99,7 @@ import { DOMParser } from '@xmldom/xmldom' readonly class properties (aka `NodeType`), these can be accessed from any `Node` instance `node`: `if (node.nodeType === node.ELEMENT_NODE) {...` - + 1. `ELEMENT_NODE` (`1`) 2. `ATTRIBUTE_NODE` (`2`) 3. `TEXT_NODE` (`3`) @@ -112,14 +112,14 @@ import { DOMParser } from '@xmldom/xmldom' 10. `DOCUMENT_TYPE_NODE` (`10`) 11. `DOCUMENT_FRAGMENT_NODE` (`11`) 12. `NOTATION_NODE` (`12`) - + attribute: - - `nodeValue` | `prefix` - + - `nodeValue` | `prefix` | `textContent` + readonly attribute: - - `nodeName` | `nodeType` | `parentNode` | `childNodes` | `firstChild` | `lastChild` | `previousSibling` | `nextSibling` | `attributes` | `ownerDocument` | `namespaceURI` | `localName` - - method: + - `nodeName` | `nodeType` | `parentNode` | `parentElement` | `childNodes` | `firstChild` | `lastChild` | `previousSibling` | `nextSibling` | `attributes` | `ownerDocument` | `namespaceURI` | `localName` | `isConnected` | `baseURI` + + method: * `insertBefore(newChild, refChild)` * `replaceChild(newChild, oldChild)` * `removeChild(oldChild)` @@ -127,6 +127,10 @@ import { DOMParser } from '@xmldom/xmldom' * `hasChildNodes()` * `cloneNode(deep)` * `normalize()` + * `contains(otherNode)` + * `getRootNode()` + * `isEqualNode(otherNode)` + * `isSameNode(otherNode)` * `isSupported(feature, version)` * `hasAttributes()` * [DOMException](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html) @@ -149,7 +153,7 @@ import { DOMParser } from '@xmldom/xmldom' - `INVALID_MODIFICATION_ERR` (`13`) - `NAMESPACE_ERR` (`14`) - `INVALID_ACCESS_ERR` (`15`) - + attributes: - `code` with a value matching one of the above constants. @@ -183,7 +187,7 @@ import { DOMParser } from '@xmldom/xmldom' * [DocumentFragment](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-B63ED1A3) : Node * [Element](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-745549614) : Node - + readonly attribute: - `tagName` @@ -317,23 +321,23 @@ The original author claims that xmldom implements [DOM Level 2] in a "fully comp In the past, there have been multiple (even breaking) changes to align xmldom with the living standard, so if you find a difference that is not documented, any contribution to resolve the difference is very welcome (even just reporting it as an issue). -xmldom implements the following interfaces (only the ones marked with `*` are currently exposed): -- `Attr` * +xmldom implements the following interfaces: +- `Attr` - `CDATASection` - `CharacterData` - `Comment` -- `Document` * +- `Document` - `DocumentFragment` -- `DocumentType` * -- `DOMException` * -- `DOMImplementation` * -- `Element` * +- `DocumentType` +- `DOMException` +- `DOMImplementation` +- `Element` - `Entity` - `EntityReference` - `LiveNodeList` -- `NamedNodeMap` * -- `Node` * -- `NodeList` * +- `NamedNodeMap` +- `Node` +- `NodeList` - `Notation` - `ProcessingInstruction` - `Text` diff --git a/test/dom/document.test.js b/test/dom/document.test.js index 07c5f0ded..87ba16585 100644 --- a/test/dom/document.test.js +++ b/test/dom/document.test.js @@ -318,6 +318,29 @@ describe('Document.prototype', () => { expectDOMException(() => doc.createAttribute('123'), DOMExceptionName.InvalidCharacterError, 'in name "123"'); }); }); + describe('createEntityReference', () => { + const NAME = 'NaMe'; + test('should create EntityReference in XML documents', () => { + const doc = new DOMImplementation().createDocument(null, ''); + + const eref = doc.createEntityReference(NAME); + + expect(eref.ownerDocument).toBe(doc); + expect(eref.nodeType).toBe(doc.ENTITY_REFERENCE_NODE); + expect(eref.nodeName).toBe(NAME); + expect(eref.childNodes).toHaveLength(0); + }); + test('should throw NotSupportedError in HTML document', () => { + const doc = new DOMImplementation().createHTMLDocument(false); + + expectDOMException(() => doc.createEntityReference('valid'), DOMExceptionName.NotSupportedError, 'html'); + }); + test('should throw InvalidCharacter DOMException if name is not matching Name', () => { + const doc = new DOMImplementation().createHTMLDocument(false); + + expectDOMException(() => doc.createEntityReference('123'), DOMExceptionName.InvalidCharacterError, 'name "123"'); + }); + }); describe('insertBefore', () => { test('should insert the first element and set `documentElement`', () => { const doc = new DOMImplementation().createDocument(null, ''); diff --git a/test/dom/node.test.js b/test/dom/node.test.js index ac6739a82..6835e7e71 100644 --- a/test/dom/node.test.js +++ b/test/dom/node.test.js @@ -1,6 +1,6 @@ 'use strict'; -const { describe, test } = require('@jest/globals'); +const { describe, test, expect } = require('@jest/globals'); const { DOMImplementation, Node } = require('../../lib/dom'); const { DOMExceptionName } = require('../../lib/errors'); const { expectDOMException } = require('../errors/expectDOMException'); @@ -29,4 +29,261 @@ describe('Node.prototype', () => { }); }); }); + describe('isConnected', () => { + const impl = new DOMImplementation(); + const doc = impl.createDocument(null, ''); + const el = doc.createElement('test'); + + test('should return false if node is not inside of a document', () => { + expect(el.isConnected).toBe(false); + }); + test('should return true if node is inside of a document', () => { + doc.appendChild(el); + expect(el.isConnected).toBe(true); + }); + }); + describe('parentElement', () => { + const impl = new DOMImplementation(); + const doc = impl.createDocument(null, ''); + const el1 = doc.createElement('test1'); + const el2 = doc.createElement('test2'); + + test('should return null if there is no parent node', () => { + expect(el1.parentElement).toBe(null); + }); + test('should return null if parentNode is the document node', () => { + doc.appendChild(el1); + expect(el1.parentElement).toBe(null); + }); + test('should return parent element if parentNode is an element', () => { + el1.appendChild(el2); + expect(el2.parentElement).toBe(el1); + }); + }); + describe('contains', () => { + const impl = new DOMImplementation(); + const doc = impl.createDocument(null, ''); + const el1 = doc.createElement('test1'); + const el2 = doc.createElement('test2'); + el1.appendChild(el2); + + test('should return true if otherNode is a child of this node', () => { + expect(el1.contains(el2)).toBe(true); + }); + test('should return true if otherNode is this node', () => { + expect(el1.contains(el1)).toBe(true); + }); + test('should return false if otherNode is a parent of this node', () => { + expect(el2.contains(el1)).toBe(false); + }); + test('should return false if otherNode null or undefined', () => { + expect(el2.contains(undefined)).toBe(false); + expect(el2.contains(null)).toBe(false); + }); + }); + describe('getRootNode', () => { + const impl = new DOMImplementation(); + const doc = impl.createDocument(null, ''); + const el1 = doc.createElement('test1'); + const el2 = doc.createElement('test2'); + el1.appendChild(el2); + + test('should return the root node of a structure with no document node', () => { + expect(el2.getRootNode()).toEqual(el1); + }); + test('should return itself if this is already the root node', () => { + expect(el1.getRootNode()).toEqual(el1); + }); + test('should return the document node when it is the root node', () => { + doc.appendChild(el1); + expect(el2.getRootNode()).toEqual(doc); + }); + }); + describe('isEqualNode', () => { + const impl = new DOMImplementation(); + const doc = impl.createDocument(null, ''); + + test('should return false when other node is null', () => { + expect(doc.isEqualNode(null)).toBe(false); + }); + + test("should return false when node types don't match", () => { + expect(doc.isEqualNode(doc.createAttribute('attr1'))).toBe(false); + }); + + describe('Element', () => { + test('should return false when both elements have a different amount of child nodes', () => { + const el1 = doc.createElement('p'); + el1.appendChild(doc.createElement('child1')); + el1.appendChild(doc.createElement('child2')); + + const el2 = doc.createElement('p'); + el2.appendChild(doc.createElement('child1')); + expect(el1.tagName).toBe(el2.tagName); + expect(el1.firstChild.isEqualNode(el2.firstChild)).toBe(true); + expect(el1.isEqualNode(el2)).toBe(false); + }); + + test('should return false for elements with different localName', () => { + expect(doc.createElement('one').isEqualNode(doc.createElement('two'))).toBe(false); + }); + + test('should return false for elements with same namespace and localName but different prefix', () => { + const oneLocal = doc.createElementNS('namespaceURI', 'one:local'); + const twoLocal = doc.createElementNS('namespaceURI', 'two:local'); + expect(oneLocal.isEqualNode(twoLocal)).toBe(false); + }); + test('should return false for elements with different attributes', () => { + const el3 = doc.createElement('test3'); + const el4 = doc.createElement('test3'); + + el3.setAttribute('class', 'test-class'); + expect(el3.isEqualNode(el4)).toBe(false); + }); + + test('should return true for elements with identical attributes in a different order', () => { + const el3 = doc.createElement('test3'); + el3.setAttribute('style', ''); + el3.setAttribute('class', 'test-class'); + const el4 = doc.createElement('test3'); + el4.setAttribute('class', 'test-class'); + el4.setAttribute('style', ''); + expect(el3.toString()).not.toEqual(el4.toString()); + expect(el3.isEqualNode(el4)).toBe(true); + }); + + test('should return true for identical elements with the same tag name and no children', () => { + const el3 = doc.createElement('test3'); + const el4 = doc.createElement('test3'); + expect(el3.isEqualNode(el4)).toBe(true); + }); + }); + describe('Attribute', () => { + test('should return false if namespaceURI is different', () => { + const attr1 = doc.createAttributeNS('namespace1', 'ns:a'); + const attr2 = doc.createAttributeNS('namespace2', 'ns:a'); + expect(attr1.isEqualNode(attr2)).toBe(false); + }); + test('should return false if localName is different in namespaced attribute', () => { + const attr1 = doc.createAttributeNS('namespace1', 'ns:a'); + const attr2 = doc.createAttributeNS('namespace1', 'ns:b'); + expect(attr1.isEqualNode(attr2)).toBe(false); + }); + test('should return false if localName is different in attribute without namespace', () => { + const attr1 = doc.createAttribute('a'); + const attr2 = doc.createAttribute('b'); + expect(attr1.isEqualNode(attr2)).toBe(false); + }); + test('should return false if value is different', () => { + const attr1 = doc.createAttribute('a'); + attr1.value = 'first'; + const attr2 = doc.createAttribute('a'); + attr2.value = 'second'; + expect(attr1.isEqualNode(attr2)).toBe(false); + }); + }); + + describe('Text', () => { + test('should return true for text nodes with the same data', () => { + expect(doc.createTextNode('some text').isEqualNode(doc.createTextNode('some text'))).toBe(true); + }); + + test('should return false for text nodes with different data', () => { + expect(doc.createTextNode('some text').isEqualNode(doc.createTextNode('different text'))).toBe(false); + }); + }); + describe('Comment', () => { + test('should return true for comment nodes with the same data', () => { + expect(doc.createComment('This is a comment').isEqualNode(doc.createComment('This is a comment'))).toBe(true); + }); + + test('should return false for comment nodes with different data', () => { + expect(doc.createComment('This is a comment').isEqualNode(doc.createComment('This is a different comment'))).toBe(false); + }); + }); + describe('DocumentType', () => { + test('should return true for document type nodes with identical names and IDs', () => { + expect(impl.createDocumentType('html').isEqualNode(impl.createDocumentType('html'))).toBe(true); + }); + + test('should return false for document type nodes with different names', () => { + expect(impl.createDocumentType('html').isEqualNode(impl.createDocumentType('svg', '', ''))).toBe(false); + }); + + test('should return false for document type nodes with different publicId', () => { + expect(impl.createDocumentType('xml', 'pubId').isEqualNode(impl.createDocumentType('xml', ''))).toBe(false); + }); + + test('should return false for document type nodes with different systemId', () => { + expect(impl.createDocumentType('xml', 'pubId').isEqualNode(impl.createDocumentType('xml', 'pubId', 'sysId'))).toBe(false); + }); + }); + + test('should return false for elements with different namespaces', () => { + const el5 = doc.createElementNS('http://www.example.com', 'test5'); + const el6 = doc.createElementNS('http://www.another-example.com', 'test5'); + expect(el5.isEqualNode(el6)).toBe(false); + }); + + test('should return true for elements with the same namespaces, prefix, and localName', () => { + const el5 = doc.createElementNS('http://www.example.com', 'prefix:test5'); + const el6 = doc.createElementNS('http://www.example.com', 'prefix:test5'); + expect(el5.isEqualNode(el6)).toBe(true); + }); + + test('should return false when attributes are not equal even if the rest of the node is', () => { + const el7 = doc.createElement('test7'); + const el8 = doc.createElement('test7'); + el7.setAttribute('attr', 'value1'); + el8.setAttribute('attr', 'value2'); + expect(el7.isEqualNode(el8)).toBe(false); + }); + describe('ProcessingInstruction', () => { + test('should return true for processing instruction nodes with the same target and data', () => { + const pi1 = doc.createProcessingInstruction('xml-stylesheet', 'href="mystyle.css"'); + const pi2 = doc.createProcessingInstruction('xml-stylesheet', 'href="mystyle.css"'); + expect(pi1.isEqualNode(pi2)).toBe(true); + }); + + test('should return false for processing instruction nodes with different target or data', () => { + const pi1 = doc.createProcessingInstruction('xml-stylesheet', 'href="mystyle.css"'); + const pi2 = doc.createProcessingInstruction('xml-stylesheet', 'href="yourstyle.css"'); + expect(pi1.isEqualNode(pi2)).toBe(false); + }); + }); + + describe('childNodes', () => { + test('should return false for elements with different child nodes', () => { + const el1 = doc.createElement('p'); + el1.appendChild(doc.createElement('child1')); + el1.firstChild.textContent = 'New text'; + + const el2 = doc.createElement('p'); + el2.appendChild(doc.createElement('child1')); + + expect(el1.isEqualNode(el2)).toBe(false); + }); + + test('should return true for nodes with equal child nodes', () => { + const el9 = doc.createElement('parent'); + el9.appendChild(doc.createElement('child')); + const el10 = doc.createElement('parent'); + el10.appendChild(doc.createElement('child')); + expect(el9.isEqualNode(el10)).toBe(true); + }); + }); + }); + describe('isSameNode', () => { + const impl = new DOMImplementation(); + const doc = impl.createDocument(null, ''); + const el1 = doc.createElement('test1'); + const el2 = doc.createElement('test2'); + + test('should return true if both nodes are referencing the same object', () => { + expect(el1.isSameNode(el1)).toBe(true); + }); + test('should return false if one node is referencing a different object', () => { + expect(el1.isSameNode(el2)).toBe(false); + }); + }); }); From 437c59dd572640473f4ea935b691aa35ef678774 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 07:59:33 +0200 Subject: [PATCH 12/14] chore(deps): update dependency eslint-plugin-n to v17.10.3 (#739) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [eslint-plugin-n](https://redirect.github.com/eslint-community/eslint-plugin-n) | [`17.10.2` -> `17.10.3`](https://renovatebot.com/diffs/npm/eslint-plugin-n/17.10.2/17.10.3) | [![age](https://developer.mend.io/api/mc/badges/age/npm/eslint-plugin-n/17.10.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/eslint-plugin-n/17.10.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/eslint-plugin-n/17.10.2/17.10.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/eslint-plugin-n/17.10.2/17.10.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
eslint-community/eslint-plugin-n (eslint-plugin-n) ### [`v17.10.3`](https://redirect.github.com/eslint-community/eslint-plugin-n/blob/HEAD/CHANGELOG.md#17103-2024-09-18) [Compare Source](https://redirect.github.com/eslint-community/eslint-plugin-n/compare/v17.10.2...v17.10.3) ##### 🩹 Fixes - Use our data set to work out if a module is a node module ([#​338](https://redirect.github.com/eslint-community/eslint-plugin-n/issues/338)) ([6a1b2c5](https://redirect.github.com/eslint-community/eslint-plugin-n/commit/6a1b2c5606f0c6a37b38b60d780df8698db22a87)) ##### 📚 Documentation - **process-exit-as-throw:** update wording ([#​323](https://redirect.github.com/eslint-community/eslint-plugin-n/issues/323)) ([e5e758e](https://redirect.github.com/eslint-community/eslint-plugin-n/commit/e5e758ea0cd238220127ae7bcbd967f1d8920f28))
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/xmldom/xmldom). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index b143cb712..3e117f1a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "eslint-config-prettier": "9.1.0", "eslint-plugin-anti-trojan-source": "1.1.1", "eslint-plugin-es5": "1.5.0", - "eslint-plugin-n": "17.10.2", + "eslint-plugin-n": "17.10.3", "eslint-plugin-prettier": "5.2.1", "get-stream": "6.0.1", "jest": "29.7.0", @@ -3978,9 +3978,9 @@ } }, "node_modules/eslint-plugin-n": { - "version": "17.10.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-17.10.2.tgz", - "integrity": "sha512-e+s4eAf5NtJaxPhTNu3qMO0Iz40WANS93w9LQgYcvuljgvDmWi/a3rh+OrNyMHeng6aOWGJO0rCg5lH4zi8yTw==", + "version": "17.10.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-17.10.3.tgz", + "integrity": "sha512-ySZBfKe49nQZWR1yFaA0v/GsH6Fgp8ah6XV0WDz6CN8WO0ek4McMzb7A2xnf4DCYV43frjCygvb9f/wx7UUxRw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", @@ -13673,9 +13673,9 @@ "requires": {} }, "eslint-plugin-n": { - "version": "17.10.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-17.10.2.tgz", - "integrity": "sha512-e+s4eAf5NtJaxPhTNu3qMO0Iz40WANS93w9LQgYcvuljgvDmWi/a3rh+OrNyMHeng6aOWGJO0rCg5lH4zi8yTw==", + "version": "17.10.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-17.10.3.tgz", + "integrity": "sha512-ySZBfKe49nQZWR1yFaA0v/GsH6Fgp8ah6XV0WDz6CN8WO0ek4McMzb7A2xnf4DCYV43frjCygvb9f/wx7UUxRw==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.4.0", diff --git a/package.json b/package.json index f7fab6988..11a152ea1 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "eslint-config-prettier": "9.1.0", "eslint-plugin-anti-trojan-source": "1.1.1", "eslint-plugin-es5": "1.5.0", - "eslint-plugin-n": "17.10.2", + "eslint-plugin-n": "17.10.3", "eslint-plugin-prettier": "5.2.1", "get-stream": "6.0.1", "jest": "29.7.0", From eaafa8fa08f2c8cb16b0d0167405f00df11faf73 Mon Sep 17 00:00:00 2001 From: Christian Bewernitz Date: Sat, 21 Sep 2024 13:25:40 +0200 Subject: [PATCH 13/14] docs: prepare changelog for 0.9.3 (#740) --- CHANGELOG.md | 31 +++++++++++++++++++++++++++++++ package.json | 2 +- readme.md | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0bc0af74..63717270d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,37 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.9.3](https://github.com/xmldom/xmldom/compare/0.9.2...0.9.3) + +### Fixed + +- restore more `Node` and `ProcessingInstruction` types [`#725`](https://github.com/xmldom/xmldom/issues/725) / [`#726`](https://github.com/xmldom/xmldom/pull/726) +- `getElements*` methods return `LiveNodeList<Element>` [`#731`](https://github.com/xmldom/xmldom/issues/731) / [`#734`](https://github.com/xmldom/xmldom/pull/734) +- Add more missing `Node` props [`#728`](https://github.com/xmldom/xmldom/pull/728), triggered by unclosed [`#724`](https://github.com/xmldom/xmldom/pull/724) + +### Docs + +- Update supported runtimes in readme (NodeJS >= 14.6 and other [ES5 compatible runtimes](https://compat-table.github.io/compat-table/es5/)) + +### Chore + +- updates devDependencies + +Thank you, +[@Ponynjaa](https://github.com/Ponynjaa), +[@ayZagen](https://github.com/ayZagen), +[@sserdyuk](https://github.com/sserdyuk), +[@wydengyre](https://github.com/wydengyre), +[@mykola-mokhnach](https://github.com/mykola-mokhnach), +[@benkroeger](https://github.com/benkroeger), +for your contributions. + +# Changelog + +All notable changes to this project will be documented in this file. + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + ## [0.9.2](https://github.com/xmldom/xmldom/compare/0.9.1...0.9.2) ### Feature diff --git a/package.json b/package.json index 11a152ea1..dfd502e30 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "release": "np --no-yarn --test-script testrelease" }, "engines": { - "node": ">=14.0.0" + "node": ">=14.6" }, "devDependencies": { "@homer0/prettier-plugin-jsdoc": "9.0.2", diff --git a/readme.md b/readme.md index 1496c9e9c..cf96422db 100644 --- a/readme.md +++ b/readme.md @@ -34,7 +34,7 @@ xmldom is a javascript [ponyfill](https://ponyfill.com/) to provide the followin new XMLSerializer().serializeToString(node) => string ``` -The target runtimes `xmldom` supports are currently Node >= v10 (ES5) and Rhino ([not tested as part of CI](https://github.com/xmldom/xmldom/discussions/214)). +The target runtimes `xmldom` supports are currently Node >= v14.6 (and very likely any other [ES5 compatible runtime](https://compat-table.github.io/compat-table/es5/)). When deciding how to fix bugs or implement features, `xmldom` tries to stay as close as possible to the various [related specifications/standards](#specs). As indicated by the version starting with `0.`, this implementation is not feature complete and some implemented features differ from what the specifications describe. From 5b7382fb0070e5fac8584b6d905b8df8e074a6d3 Mon Sep 17 00:00:00 2001 From: Christian Bewernitz Date: Sat, 21 Sep 2024 13:28:26 +0200 Subject: [PATCH 14/14] 0.9.3 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3e117f1a2..06c1d8899 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@xmldom/xmldom", - "version": "0.9.2", + "version": "0.9.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@xmldom/xmldom", - "version": "0.9.2", + "version": "0.9.3", "license": "MIT", "devDependencies": { "@homer0/prettier-plugin-jsdoc": "9.0.2", diff --git a/package.json b/package.json index dfd502e30..0a58f4947 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xmldom/xmldom", - "version": "0.9.2", + "version": "0.9.3", "description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.", "keywords": [ "w3c",