summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2013-06-13 21:37:02 (GMT)
committerAlex Pott2013-06-13 21:37:02 (GMT)
commit336050289082cd877d71c147781d686e0e121827 (patch)
tree8d1c240ef418698c3ca55838cb37a32ced70eea1
parent814089c93e27561b17cb06c64bef9e61dea6df30 (diff)
Issue #2009584 by rteijeiro, ry5n: Fixed Allow double underscores to pass through drupal_clean_css_identifier() as per new CSS standards.
-rw-r--r--core/includes/common.inc2
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Common/HtmlIdentifierUnitTest.php4
2 files changed, 5 insertions, 1 deletions
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 5387f71..3215de9 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -2609,7 +2609,7 @@ function drupal_delete_file_if_stale($uri) {
* @return
* The cleaned identifier.
*/
-function drupal_clean_css_identifier($identifier, $filter = array(' ' => '-', '_' => '-', '/' => '-', '[' => '-', ']' => '')) {
+function drupal_clean_css_identifier($identifier, $filter = array(' ' => '-', '_' => '-', '__' => '__', '/' => '-', '[' => '-', ']' => '')) {
// By default, we filter using Drupal's coding standards.
$identifier = strtr($identifier, $filter);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/HtmlIdentifierUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/HtmlIdentifierUnitTest.php
index df4046c..a81feb8 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/HtmlIdentifierUnitTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/HtmlIdentifierUnitTest.php
@@ -35,6 +35,10 @@ class HtmlIdentifierUnitTest extends UnitTestBase {
// Verify that invalid characters (including non-breaking space) are stripped from the identifier.
$this->assertIdentical(drupal_clean_css_identifier('invalid !"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ identifier', array()), 'invalididentifier', 'Strip invalid characters.');
+
+ // Verify that double underscores are not stripped from the identifier.
+ $identifier = 'css__identifier__with__double__underscores';
+ $this->assertIdentical(drupal_clean_css_identifier($identifier), $identifier, 'Verify double underscores pass through.');
}
/**