diff -u b/core/modules/breakpoint/lib/Drupal/breakpoint/Breakpoint.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Breakpoint.php --- b/core/modules/breakpoint/lib/Drupal/breakpoint/Breakpoint.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Breakpoint.php @@ -295,7 +295,7 @@ foreach ($query_parts as $query_part) { $matches = array(); // Check expression: '(' S* media_feature S* [ ':' S* expr ]? ')' S* - if (preg_match('/^\(([\w\-]+)(:\s?([\w\-]+))?\)/', trim($query_part), $matches)) { + if (preg_match('/^\(([\w\-]+)(:\s?([\w\-\.]+))?\)/', trim($query_part), $matches)) { // Single expression. if (isset($matches[1]) && !isset($matches[2])) { if (!array_key_exists($matches[1], $media_features)) { @@ -318,7 +318,7 @@ switch ($media_features[$matches[1]]) { case 'length': $length_matches = array(); - if (preg_match('/^(\-)?(\d+)?((?:|em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|dpi|dpcm))$/i', trim($value), $length_matches)) { + if (preg_match('/^(\-)?(\d+(?:\.\d+)?)?((?:|em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|dpi|dpcm))$/i', trim($value), $length_matches)) { // Only -0 is allowed. if ($length_matches[1] === '-' && $length_matches[2] !== '0') { throw new InvalidBreakpointMediaQueryException('Invalid length detected.'); diff -u b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointMediaQueryTest.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointMediaQueryTest.php --- b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointMediaQueryTest.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointMediaQueryTest.php @@ -52,6 +52,7 @@ 'screen and (width: 0em)', 'screen and (min-width: -0)', 'screen and (max-width: 0)', + 'screen and (max-width: 0.3)', 'screen and (min-width)', // Multiline and comments. 'screen and /* this is a comment */ (min-width)', @@ -60,12 +61,7 @@ ); foreach ($media_queries as $media_query) { - try { - $this->assertTrue(Breakpoint::isValidMediaQuery($media_query), $media_query . ' is valid.'); - } - catch (InvalidBreakpointMediaQueryException $e) { - $this->assertTrue(FALSE, $media_query . ' is valid.'); - } + $this->assertTrue(Breakpoint::isValidMediaQuery($media_query), $media_query . ' is valid.'); } }