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

textContent vs. innerText #1596

Closed
BobFrankston opened this issue Sep 8, 2016 · 1 comment
Closed

textContent vs. innerText #1596

BobFrankston opened this issue Sep 8, 2016 · 1 comment

Comments

@BobFrankston
Copy link

innerText returns null but textContent works.

In the browser:

<!DOCTYPE html>
<html><head><title>JS Bin</title>
</head><body></body></html>

var tt = document.getElementsByTagName("title")[0];
console.log("Content: " + tt.textContent);
console.log("Inner:  "  + tt.innerText);

"Content: JS Bin"
"Inner:  JS Bin"

**** In Node with JSDOM ***
{
   let jd = jsd.jsdom("<!DOCTYPE html><html><head><title>JS Bin</title></head><body></body> </html>");
    var tt =jd.getElementsByTagName("title")[0];
    console.log("Content: " + tt.textContent);
    console.log("Inner:  " + tt.innerText);
}

Content: JS Bin
Inner:  undefined
@domenic
Copy link
Member

domenic commented Sep 8, 2016

Yeah. Dupe of #1245. Thanks for the nice test case!

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

No branches or pull requests

2 participants