Skip to content
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

Use element.localName over element.tagName.toLowerCase() #696

Merged
merged 1 commit into from
Aug 23, 2022

Conversation

marcoroth
Copy link
Member

element.tagName always returns the elements tag name in all uppercase so we needed to cast it to all lower-case in order to fit our needs.

In contrast, element.localName returns the actual tag HTML name, so this is more accurate.

Since we are already using element.localName in a few other places in the codebase and because of it's good browser-support it's much more preferable to use.

@dhh dhh merged commit 80ea697 into hotwired:main Aug 23, 2022
@marcoroth marcoroth deleted the use-local-name-over-tag-name branch August 23, 2022 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants