Skip to content

Commit 4505d4f

Browse files
Remove quotes only when attributes do not contains whitespaces
1 parent 4f1c271 commit 4505d4f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Middleware/RemoveQuotes.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ class RemoveQuotes extends PageSpeed
77
public function apply($buffer)
88
{
99
$replace = [
10-
'/ src="(.*?)"/' => ' src=$1',
11-
'/ width="(.*?)"/' => ' width=$1',
12-
'/ height="(.*?)"/' => ' height=$1',
13-
'/ name="(.*?)"/' => ' name=$1',
14-
'/ charset="(.*?)"/' => ' charset=$1',
15-
'/ align="(.*?)"/' => ' align=$1',
16-
'/ border="(.*?)"/' => ' border=$1',
17-
'/ crossorigin="(.*?)"/' => ' crossorigin=$1',
18-
'/ type="(.*?)"/' => ' type=$1',
10+
'/ src="(.\S*?)"/' => ' src=$1',
11+
'/ width="(.\S*?)"/' => ' width=$1',
12+
'/ height="(.\S*?)"/' => ' height=$1',
13+
'/ name="(.\S*?)"/' => ' name=$1',
14+
'/ charset="(.\S*?)"/' => ' charset=$1',
15+
'/ align="(.\S*?)"/' => ' align=$1',
16+
'/ border="(.\S*?)"/' => ' border=$1',
17+
'/ crossorigin="(.\S*?)"/' => ' crossorigin=$1',
18+
'/ type="(.\S*?)"/' => ' type=$1',
1919
'/\/>/' => '>',
2020
];
2121

0 commit comments

Comments
 (0)