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

<textarea> and DOMParser are lossy with \r character #1

Open
xBZZZZ opened this issue Jun 30, 2023 · 1 comment
Open

<textarea> and DOMParser are lossy with \r character #1

xBZZZZ opened this issue Jun 30, 2023 · 1 comment

Comments

@xBZZZZ
Copy link
Owner

xBZZZZ commented Jun 30, 2023

var t=document.createElement('textarea');
t.value='\r\n';
console.log(t.value.length);//logs 1

'\r\n''\n'
'\r''\n'
this is bad because doing nothing and pressing back in many dialogs can actually change stuff!

@xBZZZZ xBZZZZ pinned this issue Jun 30, 2023
@xBZZZZ
Copy link
Owner Author

xBZZZZ commented Jun 30, 2023

also DOMParser:

console.log(new DOMParser().parseFromString('<x>\r\n</x>','application/xml').documentElement.textContent.length);//logs 1

but

console.log(new DOMParser().parseFromString('<x>&#13;&#10;</x>','application/xml').documentElement.textContent.length);//logs 2

@xBZZZZ xBZZZZ changed the title textarea is lossy with \r character <textarea> and DOMParser are lossy with \r character Jun 30, 2023
xBZZZZ added a commit that referenced this issue Jul 2, 2023
•replace toggler+textarea with AdvTextArea
•handle \r better (see issue #1)
•replace tbd_set_disabled with set_loading
•redesign string editor
•more console helpers
@xBZZZZ xBZZZZ unpinned this issue Mar 27, 2024
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

1 participant