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

HTML nodeName and tagName properties of nodes are in upper case #37744

Closed
domleonard opened this issue Jan 21, 2025 · 3 comments · Fixed by #37797
Closed

HTML nodeName and tagName properties of nodes are in upper case #37744

domleonard opened this issue Jan 21, 2025 · 3 comments · Fixed by #37797
Labels
Content:WebAPI Web API docs goal: clarity (Experimental label) Issues about unclear/confusing/inconcise content. good first issue A good issue for newcomers to get started with.

Comments

@domleonard
Copy link
Contributor

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement

What specific section or headline is this issue about?

https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement#parameters - tagName

What information was incorrect, unhelpful, or incomplete?

While nodeName and tagName are held in DOM nodes of HTML pages in upper case, description for the tagName parameter states the opposite:

When called on an HTML document, createElement() converts tagName to lower case before creating the element.

What did you expect to see?

When called on an HTML document, createElement() converts tagName to upper case before creating the element.

Do you have any supporting links, references, or citations?

console.log(document.querySelector('html').tagName);

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@domleonard domleonard added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jan 21, 2025
@github-actions github-actions bot added the Content:WebAPI Web API docs label Jan 21, 2025
@Josh-Cena
Copy link
Member

This is consistent with the HTML spec https://dom.spec.whatwg.org/#dom-document-createelement:

If this is an HTML document, then set localName to localName in ASCII lowercase.

tagName is the odd one here, not createElement. All intrinsic elements are lowercase, but tagName and nodeName uppercases them specifically before returning it. You can observe the lowercase tag name via any other method, such as the browser's devtools.

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2025
@Josh-Cena Josh-Cena added closed: question A user misinterpretation or support question. No action required. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jan 22, 2025
@wbamberg
Copy link
Collaborator

I looked at this and had a similar thought, but the use of tagName here instead of localName is very confusing, and I suggest we change that.

@Josh-Cena
Copy link
Member

Agreed, let's use localName instead.

@Josh-Cena Josh-Cena reopened this Jan 22, 2025
@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jan 22, 2025
@Josh-Cena Josh-Cena added good first issue A good issue for newcomers to get started with. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. closed: question A user misinterpretation or support question. No action required. labels Jan 23, 2025
@caugner caugner added the goal: clarity (Experimental label) Issues about unclear/confusing/inconcise content. label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs goal: clarity (Experimental label) Issues about unclear/confusing/inconcise content. good first issue A good issue for newcomers to get started with.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants