Skip to content

Converted Koenig DOM cleaner to TypeScript#28236

Merged
EvanHahn merged 1 commit into
mainfrom
clean-dom-typescriptify
May 28, 2026
Merged

Converted Koenig DOM cleaner to TypeScript#28236
EvanHahn merged 1 commit into
mainfrom
clean-dom-typescriptify

Conversation

@EvanHahn
Copy link
Copy Markdown
Contributor

no ref

This change should have no user impact. It converts the cleanDOM function to TypeScript. It also had some type errors (using nodes instead of elements), which this fixes.

no ref

This change should have no user impact. It converts the `cleanDOM`
function to TypeScript. It also had some type errors (using nodes
instead of elements), which this fixes.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9fc82401-53ca-44ec-8e25-598a623f98eb

📥 Commits

Reviewing files that changed from the base of the PR and between 590f4f9 and e29b6da.

📒 Files selected for processing (2)
  • ghost/core/core/server/services/koenig/render-utils/clean-dom.js
  • ghost/core/core/server/services/koenig/render-utils/clean-dom.ts
💤 Files with no reviewable changes (1)
  • ghost/core/core/server/services/koenig/render-utils/clean-dom.js

Walkthrough

This PR migrates the cleanDOM utility function from CommonJS JavaScript to TypeScript. The function removes DOM elements whose tag names are not in an allowed list, while re-parenting their child nodes into the parent element. The new TypeScript implementation adds type safety with Element and ReadonlyArray<string> parameters while preserving the original recursive traversal and node-splicing logic.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: converting the cleanDOM function from JavaScript to TypeScript.
Description check ✅ Passed The description is directly related to the changeset, explaining the conversion to TypeScript and fixes to type errors.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch clean-dom-typescriptify

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@EvanHahn EvanHahn enabled auto-merge (squash) May 28, 2026 18:00
@EvanHahn EvanHahn merged commit be33d53 into main May 28, 2026
49 checks passed
@EvanHahn EvanHahn deleted the clean-dom-typescriptify branch May 28, 2026 18:08
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.

1 participant