diff --git a/src/assets/HTMLAsset.js b/src/assets/HTMLAsset.js index d5a8ac3fba2..64525d1267d 100644 --- a/src/assets/HTMLAsset.js +++ b/src/assets/HTMLAsset.js @@ -44,7 +44,7 @@ class HTMLAsset extends Asset { let elements = ATTRS[attr]; // Check for virtual paths if (node.tag === 'a' && node.attrs[attr].lastIndexOf('.') < 1) { - break; + continue; } if (elements && elements.includes(node.tag)) { let assetPath = this.addURLDependency(node.attrs[attr]); diff --git a/test/html.js b/test/html.js index 779f82e6d0e..436fffe0bac 100644 --- a/test/html.js +++ b/test/html.js @@ -48,6 +48,22 @@ describe('html', function() { } }); + it('should find href attr when not first', async function() { + let b = await bundle(__dirname + '/integration/html-attr-order/index.html'); + + assertBundleTree(b, { + name: 'index.html', + assets: ['index.html'], + childBundles: [ + { + type: 'html', + assets: ['other.html'], + childBundles: [] + } + ] + }); + }); + it('should support transforming HTML with posthtml', async function() { let b = await bundle(__dirname + '/integration/posthtml/index.html'); diff --git a/test/integration/html-attr-order/index.html b/test/integration/html-attr-order/index.html new file mode 100644 index 00000000000..033a2410eb1 --- /dev/null +++ b/test/integration/html-attr-order/index.html @@ -0,0 +1,9 @@ + + +
+ + +Linking to another page
+ + diff --git a/test/integration/html-attr-order/other.html b/test/integration/html-attr-order/other.html new file mode 100644 index 00000000000..6a4b6d5b384 --- /dev/null +++ b/test/integration/html-attr-order/other.html @@ -0,0 +1,8 @@ + + + + + +