Skip to content

Commit

Permalink
core(tags blocking first-paint): exclude script type=module (#3676)
Browse files Browse the repository at this point in the history
* exclude script type='module' from render blocking warnings

* pr fixes

* add 404 sample module as script source

* quick typo fix

* fix smoketests
  • Loading branch information
thisizkp authored and patrickhulce committed Nov 3, 2017
1 parent cfc2afe commit 6ba5eb1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions lighthouse-cli/test/fixtures/dobetterweb/dbw_tester.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<!-- FAIL: block rendering -->
<script src="./dbw_tester.js"></script>

<!-- PASS: 'modules' are deferred by default and don't block rendering -->
<script type="module" src="./empty_module.js?delay=500"></script>

<!-- FAIL(errors-in-console): exception thrown -->
<script type="text/javascript">throw new Error('An error');</script>

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ module.exports = [
extendedInfo: {
value: {
results: {
length: 15,
length: 16,
},
},
},
details: {
items: {
length: 15,
length: 16,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function collectTagsThatBlockFirstPaint() {
if (tag.tagName === 'SCRIPT') {
return !tag.hasAttribute('async') &&
!tag.hasAttribute('defer') &&
!/^data:/.test(tag.src);
!/^data:/.test(tag.src) &&
tag.getAttribute('type') !== 'module';
}

// Filter stylesheet/HTML imports that block rendering.
Expand Down

0 comments on commit 6ba5eb1

Please sign in to comment.