Skip to content

Commit a3a92f1

Browse files
feat: handle the data attribute of object tag (#227)
BREAKING CHANGE: the `data` attribute of `object` tag now handled
1 parent 331f45a commit a3a92f1

File tree

8 files changed

+98
-35
lines changed

8 files changed

+98
-35
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,18 @@ You may need to specify loaders for images in your configuration (recommended `f
5555

5656
## Options
5757

58-
| Name | Type | Default | Description |
59-
| :-------------------------------: | :-----------------: | :----------------------------------------------------------------------------------------------------: | :--------------------------------------- |
60-
| **[`attributes`](#attributes)** | `{Array\|String}` | `[':srcset', 'img:src', 'audio:src', 'video:src', 'track:src', 'embed:src', 'source:src','input:src']` | Enables/Disables attributes handling |
61-
| **[`root`](#root)** | `{String}` | `undefiend` | Allow to handle root-relative attributes |
62-
| **[`interpolate`](#interpolate)** | `{Boolean\|String}` | `false` | Allow to use expressions in HTML syntax |
63-
| **[`minimize`](#minimize)** | `{Boolean\|Object}` | `true` in production mode, otherwise `false` | Tell `html-loader` to minimize HTML |
64-
| **[`esModule`](#esmodule)** | `{Boolean}` | `false` | Use ES modules syntax |
58+
| Name | Type | Default | Description |
59+
| :-------------------------------: | :-----------------: | :-------------------------------------------------------------------------------------------------------------------: | :--------------------------------------- |
60+
| **[`attributes`](#attributes)** | `{Array\|String}` | `[':srcset', 'img:src', 'audio:src', 'video:src', 'track:src', 'embed:src', 'source:src','input:src', 'object:data']` | Enables/Disables attributes handling |
61+
| **[`root`](#root)** | `{String}` | `undefiend` | Allow to handle root-relative attributes |
62+
| **[`interpolate`](#interpolate)** | `{Boolean\|String}` | `false` | Allow to use expressions in HTML syntax |
63+
| **[`minimize`](#minimize)** | `{Boolean\|Object}` | `true` in production mode, otherwise `false` | Tell `html-loader` to minimize HTML |
64+
| **[`esModule`](#esmodule)** | `{Boolean}` | `false` | Use ES modules syntax |
6565

6666
### `attributes`
6767

6868
Type: `Array|String`
69-
Default: `[':srcset', 'img:src', 'audio:src', 'video:src', 'track:src', 'embed:src', 'source:src','input:src']`
69+
Default: `[':srcset', 'img:src', 'audio:src', 'video:src', 'track:src', 'embed:src', 'source:src', 'input:src', 'object:data']`
7070

7171
You can specify which tag-attribute combination should be processed by this loader via the query parameter `attributes`.
7272
Pass an array or a space-separated list of `<tag>:<attribute>` combinations. (Default: `attributes=img:src`)

src/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function getTagsAndAttributes(attributes) {
1313
'embed:src',
1414
'source:src',
1515
'input:src',
16+
'object:data',
1617
];
1718

1819
if (typeof attributes !== 'undefined') {

test/__snapshots__/attributes-option.test.js.snap

Lines changed: 42 additions & 12 deletions
Large diffs are not rendered by default.

test/__snapshots__/esModule-option.test.js.snap

Lines changed: 12 additions & 3 deletions
Large diffs are not rendered by default.

test/__snapshots__/loader.test.js.snap

Lines changed: 4 additions & 1 deletion
Large diffs are not rendered by default.

test/__snapshots__/minimize-option.test.js.snap

Lines changed: 21 additions & 9 deletions
Large diffs are not rendered by default.

test/__snapshots__/root-option.test.js.snap

Lines changed: 8 additions & 2 deletions
Large diffs are not rendered by default.

test/fixtures/simple.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,5 @@ <h2>An Ordered HTML List</h2>
111111
<video src="example.ogg" controls>
112112
Your browser does not support the video tag.
113113
</video>
114+
115+
<object width="400" height="400" data="example.pdf"></object>

0 commit comments

Comments
 (0)