Implementing domDocumentToXDocument and xslt.xsltProcessToDocument#174
Merged
leonelsanchesdasilva merged 5 commits intomainfrom Feb 11, 2026
Merged
Implementing domDocumentToXDocument and xslt.xsltProcessToDocument#174leonelsanchesdasilva merged 5 commits intomainfrom
domDocumentToXDocument and xslt.xsltProcessToDocument#174leonelsanchesdasilva merged 5 commits intomainfrom
Conversation
…`, enabling usage with JS objects instead of XML strings.
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success638 tests passing in 63 suites. Report generated by 🧪jest coverage report action from 2e24b49 |
Contributor
There was a problem hiding this comment.
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 DOMDocument/Nodeinputs intoXDocument. - Added
Xslt.xsltProcessToDocument()to return transformation output as anXDocument. - 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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enabling usage with JS objects instead of XML strings.
Resolves #171.