Skip to content

Commit cc41940

Browse files
author
Renato Marinho
authored
Merge pull request #63 from tswestendorp/remove-quotes-vue-related-patch
Don't strip quotes around Vue prop values
2 parents 95693a2 + 5708e48 commit cc41940

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

src/Middleware/RemoveQuotes.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ 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-
//'/href="(.*?)"/' => 'href=$1',
16-
'/align="(.*?)"/' => 'align=$1',
17-
'/border="(.*?)"/' => 'border=$1',
18-
'/crossorigin="(.*?)"/' => 'crossorigin=$1',
19-
//'/rel="(.*?)"/' => 'rel=$1',
20-
'/type="(.*?)"/' => 'type=$1',
10+
'/ src="(.*?)"/' => ' src=$1',
11+
'/ width="(.*?)"/' => ' width=$1',
12+
'/ height="(.*?)"/' => ' height=$1',
13+
'/ name="(.*?)"/' => ' name=$1',
14+
'/ charset="(.*?)"/' => ' charset=$1',
15+
//'/ href="(.*?)"/' => ' href=$1',
16+
'/ align="(.*?)"/' => ' align=$1',
17+
'/ border="(.*?)"/' => ' border=$1',
18+
'/ crossorigin="(.*?)"/' => ' crossorigin=$1',
19+
//'/ rel="(.*?)"/' => ' rel=$1',
20+
'/ type="(.*?)"/' => ' type=$1',
2121
'/\/>/' => '>',
2222
];
2323

tests/Boilerplate/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ <h1>Test Background Image</h1>
4848
<span ng-if="!btnLoading"> ok </span> <span ng-if="btnLoading"> <i class="fa fa-circle-o-notch fa-spin"></i> </span>
4949
</button>
5050

51+
<vue-component :src="'src'" :type="'type'" :width="200"></vue-component>
52+
5153
</form>
5254

5355
<script src="https://github.com/renatomarinho/laravel-page-speed/test/Boilerplate/js/vendor/modernizr-3.5.0.min.js"></script>

tests/Middleware/RemoveQuotes.php renamed to tests/Middleware/RemoveQuotesTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ public function testRemoveQuotes()
2323
$this->assertContains('<meta name=viewport content="width=device-width, initial-scale=1">', $response->getContent());
2424
$this->assertContains('<img src=http://emblemsbf.com/img/18346.jpg width=250 style="height:300px; padding:10px" >', $response->getContent());
2525
$this->assertContains('<img src=/images/1000coin.png>', $response->getContent());
26+
$this->assertContains('<vue-component :src="\'src\'" :type="\'type\'" :width="200"></vue-component>', $response->getContent());
2627
}
2728
}

0 commit comments

Comments
 (0)