4 ms·
I'm surprised that this pays attention to '\r' (CR) specifically, and not '\n' (LF), ' ' (space), or '\t' (tab). It doesn't seem like HTML assigns any special m
by JoshTriplett 2y ago
I'm surprised that this pays attention to '\r' (CR) specifically, and not '\n' (LF), ' ' (space), or '\t' (tab). It doesn't seem like HTML assigns any special meaning to carriage return compared to other whitespace. What is the parser doing with the locations of carriage returns?
- rurban 2y agoI also have no idea why he needs the newline-mask \r. Only <pre> blocks only on windows would need that.
- account42 2y ago<pre> blocks don't depend on the OS, that would be ridiculous.
- kristianp 2y agoIs it something to do with http headers? They have CR LF pairs terminating the lines.
- JoshTriplett 2y agoI wondered about that, but that wouldn't be described as parsing HTML, and it shouldn't involve parsing '<' and '&'.
- eknkc 2y agoProbably need to do a pass to find all \r chars, check if the next char is \n and if so, discard it. Otherwise convert it to \n. edit: Yeah, does exactly that: https://chromium-review.googlesource.com/c/chromium/src/+/5538407/33/third_party/blink/renderer/core/html/parser/html_document_parser_fastpath.cc#836 https://chromium-review.googlesource.com/c/chromium/src/+/55...