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

前端 未结 2 417
臣服心动
臣服心动 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:22

    Yes, the HTML RFC defines a line break as: http://www.w3.org/TR/html401/struct/text.html#line-breaks

    A line break is defined to be a carriage return ( ), a line feed ( ), or a carriage return/line feed pair. All line breaks constitute white space.

    However, a bare carriage return is extremely rare. I'm not surprised it doesn't work. But technically, I'd say that FF4 and Chrome are in the wrong.

    Not sure why your greasemonkey script is working. My guess is that getting el.innerHTML is converting CR to CR-LF or LF.

提交回复
热议问题