Skip to content

Conversation

@stroiman
Copy link
Member

@stroiman stroiman commented Nov 11, 2025

Implements Node.isEqualNode in the DOM

@coderabbitai
Copy link

coderabbitai bot commented Nov 11, 2025

Warning

Rate limit exceeded

@stroiman has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 10 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a077c59 and a119013.

📒 Files selected for processing (5)
  • dom/character_data.go (1 hunks)
  • dom/element.go (3 hunks)
  • dom/node.go (2 hunks)
  • internal/code-gen/scripting/configuration/dom_configuration.go (0 hunks)
  • scripting/internal/dom/node_generated.go (2 hunks)

Walkthrough

Adds node equality support across the DOM types: a new IsEqualNode(Node) bool method is declared on the Node interface and implemented on the concrete node, element, and characterData types. An internal helper isEqualNode performs recursive/type-specific comparisons. The code-generation config no longer ignores isEqualNode, and the scripting layer gains a generated binding to expose the method to JS via isEqualNode on the Node prototype.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

Areas requiring extra attention:

  • dom/node.go: verify public IsEqualNode delegates correctly to the internal comparison (avoid recursion) and confirm child-iteration logic compares corresponding children.
  • dom/element.go: confirm Namespace() is exposed correctly and element IsEqualNode compares tagName, namespace, attribute counts, and attribute values by name.
  • dom/character_data.go: confirm type assertion and Data() comparison, and delegation to node-level comparison.
  • internal/code-gen/scripting/dom_configuration.go and scripting/internal/dom/node_generated.go: ensure the generated binding matches the final runtime method signatures and error handling.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Feat/is equal node' clearly describes the main change: implementing the isEqualNode feature for Node objects in the DOM.
Description check ✅ Passed The description 'Implements Node.isEqualNode in the DOM' is directly related to the changeset, which adds isEqualNode methods across multiple DOM files.

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 562f0ac and b6e6d71.

📒 Files selected for processing (5)
  • dom/character_data.go (1 hunks)
  • dom/element.go (3 hunks)
  • dom/node.go (2 hunks)
  • internal/code-gen/scripting/configuration/dom_configuration.go (0 hunks)
  • scripting/internal/dom/node_generated.go (2 hunks)
💤 Files with no reviewable changes (1)
  • internal/code-gen/scripting/configuration/dom_configuration.go
🧰 Additional context used
🧬 Code graph analysis (4)
scripting/internal/dom/node_generated.go (5)
dom/node.go (1)
  • Node (141-193)
scripting/internal/js/script_abstractions.go (1)
  • As (8-23)
scripting/internal/js/arguments.go (1)
  • ConsumeArgument (19-40)
scripting/internal/codec/decoders.go (2)
  • ZeroValue (12-12)
  • DecodeNode (26-36)
scripting/internal/codec/encoders.go (1)
  • EncodeBoolean (37-39)
dom/element.go (1)
dom/node.go (1)
  • Node (141-193)
dom/character_data.go (2)
dom/node.go (1)
  • Node (141-193)
scripting/internal/dom/character_data_generated.go (1)
  • CharacterData (12-15)
dom/node.go (1)
scripting/internal/dom/node_generated.go (1)
  • Node (12-12)
🔇 Additional comments (6)
dom/character_data.go (1)

53-58: LGTM!

The implementation correctly checks CharacterData-specific equality (data comparison) and delegates to the base node equality check.

dom/element.go (3)

43-43: LGTM!

Adding Namespace() to the Element interface is necessary for namespace-aware equality comparisons.


128-128: LGTM!

Simple getter implementation correctly exposes the namespace field.


79-99: LGTM!

The implementation correctly extends the base node equality check with Element-specific comparisons: attributes, tagName, and namespace.

scripting/internal/dom/node_generated.go (1)

25-25: LGTM!

The generated binding correctly follows the established pattern for Node prototype methods and properly marshals arguments and return values.

Also applies to: 77-89

dom/node.go (1)

168-168: LGTM!

Adding IsEqualNode(Node) bool to the Node interface aligns with the DOM specification and completes the public API for node equality checks.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6e6d71 and a077c59.

📒 Files selected for processing (5)
  • dom/character_data.go (1 hunks)
  • dom/element.go (3 hunks)
  • dom/node.go (2 hunks)
  • internal/code-gen/scripting/configuration/dom_configuration.go (0 hunks)
  • scripting/internal/dom/node_generated.go (2 hunks)
💤 Files with no reviewable changes (1)
  • internal/code-gen/scripting/configuration/dom_configuration.go
🧰 Additional context used
🧬 Code graph analysis (4)
dom/character_data.go (2)
dom/node.go (1)
  • Node (141-193)
scripting/internal/dom/character_data_generated.go (1)
  • CharacterData (12-15)
dom/element.go (1)
dom/node.go (1)
  • Node (141-193)
dom/node.go (1)
scripting/internal/dom/node_generated.go (1)
  • Node (12-12)
scripting/internal/dom/node_generated.go (5)
dom/node.go (1)
  • Node (141-193)
scripting/internal/js/script_abstractions.go (1)
  • As (8-23)
scripting/internal/js/arguments.go (1)
  • ConsumeArgument (19-40)
scripting/internal/codec/decoders.go (1)
  • DecodeNode (26-36)
scripting/internal/codec/encoders.go (1)
  • EncodeBoolean (37-39)
🔇 Additional comments (4)
dom/character_data.go (1)

53-58: LGTM! Well-structured equality implementation.

The IsEqualNode method correctly performs type-specific comparison (character data content) before delegating to the base node comparison logic for recursive child checks.

scripting/internal/dom/node_generated.go (1)

25-25: LGTM! Generated binding follows established patterns.

The isEqualNode method registration and implementation correctly follow the same pattern as other Node methods, with proper argument decoding and result encoding.

Also applies to: 77-89

dom/node.go (1)

264-264: LGTM! Critical issues from previous review have been resolved.

Both the infinite recursion bug (line 264 now correctly calls isEqualNode instead of IsEqualNode) and the indexing bug (line 274 now correctly uses Item(i) instead of Item(0)) have been fixed. The implementation now correctly performs recursive node equality comparison.

Also applies to: 266-279

dom/element.go (1)

43-43: LGTM! Clean namespace accessor.

The Namespace() method correctly exposes the element's namespace property.

Also applies to: 128-128

Not all DOM features affected by the rules are implemented
@github-actions github-actions bot merged commit 9f1ecf4 into main Nov 11, 2025
9 checks passed
@github-actions github-actions bot deleted the feat/isEqualNode branch November 11, 2025 14: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.

2 participants