Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -78,12 +78,24 @@ class Html {
|
|||
public static function cleanCssIdentifier($identifier, array $filter = array(
|
||||
' ' => '-',
|
||||
'_' => '-',
|
||||
'__' => '__',
|
||||
'/' => '-',
|
||||
'[' => '-',
|
||||
']' => ''
|
||||
']' => '',
|
||||
)) {
|
||||
$identifier = strtr($identifier, $filter);
|
||||
// We could also use strtr() here but its much slower than str_replace(). In
|
||||
// order to keep '__' to stay '__' we first replace it with a different
|
||||
// placeholder after checking that it is not defined as a filter.
|
||||
$double_underscore_replacements = 0;
|
||||
if (!isset($filter['__'])) {
|
||||
$identifier = str_replace('__', '##', $identifier, $double_underscore_replacements);
|
||||
}
|
||||
$identifier = str_replace(array_keys($filter), array_values($filter), $identifier);
|
||||
// Replace temporary placeholder '##' with '__' only if the original
|
||||
// $identifier contained '__'.
|
||||
if ($double_underscore_replacements > 0) {
|
||||
$identifier = str_replace('##', '__', $identifier);
|
||||
}
|
||||
|
||||
// Valid characters in a CSS identifier are:
|
||||
// - the hyphen (U+002D)
|
||||
// - a-z (U+0030 - U+0039)
|
||||
|
@ -250,9 +262,9 @@ class Html {
|
|||
<body>!html</body>
|
||||
</html>
|
||||
EOD;
|
||||
// PHP's \DOMDocument serialization adds straw whitespace in case the markup
|
||||
// of the wrapping document contains newlines, so ensure to remove all
|
||||
// newlines before injecting the actual HTML body to process.
|
||||
// PHP's \DOMDocument serialization adds extra whitespace when the markup
|
||||
// of the wrapping document contains newlines, so ensure we remove all
|
||||
// newlines before injecting the actual HTML body to be processed.
|
||||
$document = strtr($document, array("\n" => '', '!html' => $html));
|
||||
|
||||
$dom = new \DOMDocument();
|
||||
|
@ -280,14 +292,16 @@ EOD;
|
|||
$body_node = $document->getElementsByTagName('body')->item(0);
|
||||
$html = '';
|
||||
|
||||
foreach ($body_node->getElementsByTagName('script') as $node) {
|
||||
static::escapeCdataElement($node);
|
||||
}
|
||||
foreach ($body_node->getElementsByTagName('style') as $node) {
|
||||
static::escapeCdataElement($node, '/*', '*/');
|
||||
}
|
||||
foreach ($body_node->childNodes as $node) {
|
||||
$html .= $document->saveXML($node);
|
||||
if ($body_node !== NULL) {
|
||||
foreach ($body_node->getElementsByTagName('script') as $node) {
|
||||
static::escapeCdataElement($node);
|
||||
}
|
||||
foreach ($body_node->getElementsByTagName('style') as $node) {
|
||||
static::escapeCdataElement($node, '/*', '*/');
|
||||
}
|
||||
foreach ($body_node->childNodes as $node) {
|
||||
$html .= $document->saveXML($node);
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
|
Reference in a new issue