Skip to content

#291 Made id also update attributes. #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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