Skip to content

Implementing domDocumentToXDocument and xslt.xsltProcessToDocument#174

Merged
leonelsanchesdasilva merged 5 commits intomainfrom
domDocumentToXDocument
Feb 11, 2026
Merged

Implementing domDocumentToXDocument and xslt.xsltProcessToDocument#174
leonelsanchesdasilva merged 5 commits intomainfrom
domDocumentToXDocument

Conversation

@leonelsanchesdasilva
Copy link
Collaborator

Enabling usage with JS objects instead of XML strings.

Resolves #171.

…`, enabling usage with JS objects instead of XML strings.
@github-actions
Copy link

github-actions bot commented Feb 11, 2026

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
78.02% (+0.09% 🔼)
3325/4262
🟡 Branches
67.84% (-0.09% 🔻)
1947/2870
🟡 Functions
71.06% (-0.05% 🔻)
388/546
🟡 Lines
78.09% (+0.05% 🔼)
3180/4072
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟡
... / dom-to-xdocument.ts
78.33% 53.13% 100% 78.57%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢 index.ts 100% 100%
25% (-15% 🔻)
100%

Test suite run success

638 tests passing in 63 suites.

Report generated by 🧪jest coverage report action from 2e24b49

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds browser-friendly APIs to avoid XML string parsing overhead by (1) converting native DOM nodes into the library’s internal XDocument representation and (2) allowing XSLT processing to return an XDocument result tree instead of a serialized string.

Changes:

  • Added domDocumentToXDocument() to convert native DOM Document/Node inputs into XDocument.
  • Added Xslt.xsltProcessToDocument() to return transformation output as an XDocument.
  • Added Jest coverage for both features (including a jsdom-based test), plus updated exports and README docs.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/dom/dom-to-xdocument.ts Implements native DOM → XDocument conversion.
src/xslt/xslt.ts Adds xsltProcessToDocument() for non-serialized output.
src/dom/index.ts Re-exports the new DOM conversion helper.
src/index.ts Exposes XDocument, XNode, and domDocumentToXDocument from the package entrypoint.
tests/dom-to-xdocument.test.ts jsdom tests for DOM → XDocument conversion and XSLT input compatibility.
tests/xslt/process-to-document.test.ts Tests for xsltProcessToDocument() output shape and equivalence to serialization.
package.json Adds jest-environment-jsdom for jsdom test execution.
README.md Documents the new DOM input + document output features.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

leonelsanchesdasilva and others added 4 commits February 11, 2026 15:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@leonelsanchesdasilva leonelsanchesdasilva merged commit 7bbca56 into main Feb 11, 2026
3 checks passed
@leonelsanchesdasilva leonelsanchesdasilva deleted the domDocumentToXDocument branch February 11, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow browser DOM objects as input

1 participant