From 6e8ae0d97c8bb1114b3b53cf6ce0a082b066e51d Mon Sep 17 00:00:00 2001 From: Jing Zhou Date: Tue, 27 Mar 2018 21:39:57 -0700 Subject: [PATCH] add support for data attr of object element (#1069) --- src/assets/HTMLAsset.js | 3 ++- test/html.js | 16 ++++++++++++++++ test/integration/html-object/file.svg | 3 +++ test/integration/html-object/index.html | 2 ++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 test/integration/html-object/file.svg create mode 100644 test/integration/html-object/index.html diff --git a/src/assets/HTMLAsset.js b/src/assets/HTMLAsset.js index 5b742356dda..fca2532e0f7 100644 --- a/src/assets/HTMLAsset.js +++ b/src/assets/HTMLAsset.js @@ -24,7 +24,8 @@ const ATTRS = { srcset: ['img', 'source'], poster: ['video'], 'xlink:href': ['use'], - content: ['meta'] + content: ['meta'], + data: ['object'] }; // A list of metadata that should produce a dependency diff --git a/test/html.js b/test/html.js index e5216670afa..b1867025d27 100644 --- a/test/html.js +++ b/test/html.js @@ -534,4 +534,20 @@ describe('html', function() { ] }); }); + + it('should support data attribute of object element', async function() { + let b = await bundle(__dirname + '/integration/html-object/index.html'); + + assertBundleTree(b, { + name: 'index.html', + assets: ['index.html'], + childBundles: [ + { + type: 'svg', + assets: ['file.svg'], + childBundles: [] + } + ] + }); + }); }); diff --git a/test/integration/html-object/file.svg b/test/integration/html-object/file.svg new file mode 100644 index 00000000000..5bf00e06842 --- /dev/null +++ b/test/integration/html-object/file.svg @@ -0,0 +1,3 @@ + + + diff --git a/test/integration/html-object/index.html b/test/integration/html-object/index.html new file mode 100644 index 00000000000..9adeaa92a26 --- /dev/null +++ b/test/integration/html-object/index.html @@ -0,0 +1,2 @@ + + \ No newline at end of file