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

Can one get the "original" name of an element? #460

Closed
marcoscaceres opened this issue May 22, 2017 · 2 comments
Closed

Can one get the "original" name of an element? #460

marcoscaceres opened this issue May 22, 2017 · 2 comments

Comments

@marcoscaceres
Copy link
Member

given:

const x = document.createElement("div");
x.innerHTML = "<TeSt>"
console.log(x.innerHTML); 
// "<test></test>"

For, x.firstElementChild, is it possible to get the, um, "original" name (i.e., "TeSt") that was used to create the element?

Checking the spec, I'm guessing no - but wanted to double check in case I missed it.

@marcoscaceres marcoscaceres changed the title Can one get the "original" name of an element Can one get the "original" name of an element? May 22, 2017
@domenic
Copy link
Member

domenic commented May 22, 2017

My understanding is that the parser is responsible for the lowercasing; the mixed-case name is never even passed to DOM's element-creation algorithms, so even if DOM wanted to store it somewhere, it couldn't.

On the other hand, if you are in an XML document, then the parser won't lowercase, I believe. So in that case it'll just be available as .localName.

@marcoscaceres
Copy link
Member Author

@domenic, thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants