forked from ashi009/node-fast-html-parser
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Line breaks are ignored by innerText #249
Labels
Comments
+1 |
I am afraid I cannot see this behavior in chrome. my test code is like this const div = document.createElement('div');
div.innerHTML = 'Hello, <br>World!';
console.log(div.innerText); |
I add a new branch for this issue, but I don't think we should merge this, because chrome does the same. |
Appears that it only works if the element is added to the DOM. Like this it's working fine. const div = document.createElement('div');
document.body.appendChild(div);
div.innerHTML = 'Hello, <br>World!';
console.log(div.innerText); |
Merged. |
And thank you for feeding back. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using the
innerText
function on elements that contain line breaks (<br>
) they get ignored in the output. A regular browser will convert them to \n characters.For exmple
Hello<br>World
will result inHelloWorld
, but expected isHello\nWorld
.The text was updated successfully, but these errors were encountered: