Skip to content

Conversation

@brainkim1
Copy link
Collaborator

@brainkim1 brainkim1 commented Nov 27, 2025

Summary

  • Fix unnecessary DOM updates when using relative URLs for src and href attributes
  • The DOM property returns the resolved absolute URL (e.g., http://localhost/path), while the prop value may be relative (/path)
  • Now we resolve the prop value using new URL(value, element.baseURI) before comparing, maintaining the "DOM as source of truth" philosophy

This completes the fix from #181 - the original fix compared element.src !== value to avoid unnecessary updates, but didn't account for URL resolution causing element.src to return an absolute URL while the prop is relative.

Test plan

  • Added tests for relative src on iframe
  • Added tests for relative href on anchor
  • Added tests for absolute URLs
  • All 43 DOM tests pass
  • Linting passes

🤖 Generated with Claude Code

The DOM property for src and href returns the resolved absolute URL,
while the prop value may be a relative URL. This caused unnecessary
DOM updates on every render when using relative URLs like "/path".

Now we resolve the prop value using new URL(value, element.baseURI)
before comparing to the DOM value, maintaining the "DOM as source of
truth" philosophy while correctly handling URL normalization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@brainkim1 brainkim1 force-pushed the fix-url-prop-comparison branch from 98c5431 to 180e315 Compare November 27, 2025 04:48
@brainkim
Copy link
Member

Thankee Claude

@brainkim brainkim merged commit 0f2ec45 into main Nov 27, 2025
6 checks passed
@brainkim brainkim deleted the fix-url-prop-comparison branch November 27, 2025 05:00
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.

3 participants