xBZZZZ / gdccdated

geometry dash CC*.dat editor
https://gdccdated.glitch.me/index.xhtml
GNU Affero General Public License v3.0
6 stars 1 forks source link

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

Open xBZZZZ opened 1 year ago

xBZZZZ commented 1 year ago
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 commented 1 year ago

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