html - Are line breaks in IE's javascript always \r\n? -
if element has <br \>
inside, , it's text innertext
property, i'm seeing line break 2 characters: 13 , 10. determines this? browser or web page's encoding?
i want either make sure line breaks going 2 characters (as long it's part of static content of web page , not dynamically created content) or modify text processing algorithm handle both possibilities.
this i'll using split text lines split
method. i'm not sure if should use split("\r\n")
or more complicated code.
it depends on editor and/or os. windows uses \r(13)\n(10). unix systems use \n. old macs used \r. replace \r\n \n , split on \n.
//"test\r\nnewline".replace('\r\n','\n').split('\n')//only replaces first newline "test\r\nnewline".replace(/\r\n/g, '\n').split('\n')
Comments
Post a Comment