Skip to content

Fix HTML rendering to handle nil values without removing sibling elements#16

Merged
askonomm merged 1 commit intomainfrom
15-ending-nils-remove-the-entire-hierarchy-at-its-level
Jan 10, 2026
Merged

Fix HTML rendering to handle nil values without removing sibling elements#16
askonomm merged 1 commit intomainfrom
15-ending-nils-remove-the-entire-hierarchy-at-its-level

Conversation

@askonomm
Copy link
Owner

This pull request improves the handling of nil values in node hierarchies within the dompa library, ensuring that nil entries do not inadvertently remove or affect sibling nodes when converting node trees to HTML. It also adds comprehensive tests to verify this behavior.

Nil handling improvements:

  • Updated nodes-from-opt in src/dompa/nodes.cljc to explicitly handle nil values, ensuring they do not propagate into node children lists.
  • Modified node construction logic in src/dompa/nodes.cljc to remove nil children and ensure the children vector only contains valid nodes.
  • Changed the HTML rendering fallback in nodes->html-fn to return the current html string instead of an empty string for unmatched cases, preventing accidental removal of siblings when encountering nil.

Testing improvements:

  • Added nil-in-hierarchy-does-not-remove-siblings-test in test/dompa/nodes_test.cljc to verify that nil values do not affect sibling elements or their HTML output in various scenarios.

…ents; add tests for nil handling in node hierarchy (#15)
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Gates Passed
4 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.

@askonomm askonomm linked an issue Jan 10, 2026 that may be closed by this pull request
@askonomm askonomm merged commit 94f5f3c into main Jan 10, 2026
2 checks passed
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.

Ending nil's remove the entire hierarchy at its level

1 participant