Skip to content

Conversation

fiddleplum
Copy link

This makes the id property private (_id) and makes getters and setters so that it updates the attributes as well.

In the actual browser changing id doesn't affect getAttribute(), since the attributes and the id are separate things. However when doing outerHTML, the actual id property is taken into account rather than the original id attribute. Not sure if you want the exact same browser behavior, which would be a little tricky, since it would require unparsing and reparsing the rawAttr property to include the updated id property. But if this is close enough, if you're good with it.

Also fixed a small bug whereby setAttributes() didn't update the id property.

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