Using only CR as linebreak inside pre tag doesn't work

前端 未结 2 420
臣服心动
臣服心动 2021-01-14 02:33

At work, we stumbled upon Bugzilla creating HTML output that led to lines much too long because the browser didn\'t break the lines. This was happening on Chrome, but not on

2条回答
  •  鱼传尺愫
    2021-01-14 03:30

    The GM script works because apparently JS converts CR's (\r) to LF (\n), dynamically on writes to the DOM.

    See this test at jsFiddle. Notice how the CR (decimal 13), at the end of the 2nd line, gets converted to LF (decimal 10).

提交回复
热议问题