Hacker News new | past | comments | ask | show | jobs | submit login

Pretty much. HTML parsing produces a content model, where the model's whitespace matches pretty faithfully what's in the source document. At some later point, that model is massaged into the thing that you see and interact with—but the model itself retains everything; this is like a filter, if it helps to think of it that way, or a projection of a complex (e.g. 3D object) onto a lesser substrate (e.g. 2D plane).

Offhand, and after a few glasses of wine, there are a couple points where the whitespace collapse will occur:

- at the display level—when it's time for the browser to actually put the thing on the screen—for CSS contexts where the white-space property is "normal" or something similar, at least, or

- at the interaction level, when something like text selection happens, and the browser computes essentially the equivalent of node.innerText (versus node.textContent; alternatively: node.nodeValue, in cases where the node in question is a text node)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: