Skip to content

Commit 16da2b6

Browse files
committed
Fix issue with non-integer x-descriptors in srcset
Example: srcset="//example.com/a.jpg 1.5x, //example.com/b.jpg 2x" resulted in srcset="1.5x, //example.com/b.jpg 2x" Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
1 parent 7362c04 commit 16da2b6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

htmLawed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ function hl_tag($t){
519519
$v = str_replace("­", ' ', (strpos($v, '&') !== false ? str_replace(array('&#xad;', '&#173;', '&shy;'), ' ', $v) : $v)); # double-quoted char: soft-hyphen; appears here as "­" or hyphen or something else depending on viewing software
520520
if($k == 'srcset'){
521521
$v2 = '';
522-
$pattern = "/(?:[^\"'\s]+\s*(?:\d+[wx])+)/";
522+
$pattern = "/(?:[^\"'\s]+\s*(?:\d+w|\d+(?:\.\d+)?x)+)/";
523523
preg_match_all($pattern, $v, $matches);
524524
$matches = call_user_func_array('array_merge', $matches);
525525
foreach($matches as $k1=>$v1){

0 commit comments

Comments
 (0)