LogMANOriginal - 2019-03-09

Good point. I'm actually not sure why newlines are removed in the first place, as browsers seem to allow them in attribute values. The comment for this particular if-statement doesn't link to any particular source:

Attributes should not have \r or \n in them, that counts as html whitespace.

The specification is also quite clear:

An attribute value is a string. Except where otherwise specified, attribute values on HTML elements may be any string value, including the empty string, and there is no restriction on what text can be specified in such attribute values.

-- https://www.w3.org/TR/html/dom.html#element-definitions-attributes

That said, removing the offending if-statement has no effect because all newline characters are replaced by blanks if $stripRN = true in load (...). Making multiline attributes possible essentially means newline characters can no longer be stripped by a simple preg_replace. It needs to be done content aware.

This is certainly something worth looking into eventually.