function StringInputStream::replaceLinefeeds
Replace linefeed characters according to the spec.
1 call to StringInputStream::replaceLinefeeds()
- StringInputStream::__construct in vendor/
masterminds/ html5/ src/ HTML5/ Parser/ StringInputStream.php - Create a new InputStream wrapper.
File
-
vendor/
masterminds/ html5/ src/ HTML5/ Parser/ StringInputStream.php, line 102
Class
Namespace
Masterminds\HTML5\ParserCode
protected function replaceLinefeeds($data) {
/*
* U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF) characters are treated specially.
* Any CR characters that are followed by LF characters must be removed, and any CR characters not
* followed by LF characters must be converted to LF characters. Thus, newlines in HTML DOMs are
* represented by LF characters, and there are never any CR characters in the input to the tokenization
* stage.
*/
$crlfTable = array(
"\x00" => "�",
"\r\n" => "\n",
"\r" => "\n",
);
return strtr($data, $crlfTable);
}