Skip to content

Commit

Permalink
chore: change attrs to attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmail committed Jan 7, 2020
1 parent 0318207 commit c4f6cfe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This is a fork based on [style-loader](https://github.com/webpack/style-loader).

Type: `boolean`. When importing the style from a non-vue-file, by default the style is injected as a side effect of the import. When `manualInject` is true, the imported style object exposes a `__inject__` method, which can then be called manually at appropriate timing. If called on the server, the method expects one argument which is the `ssrContext` to attach styles to.

``` js
```js
import styles from 'styles.scss'

export default {
Expand All @@ -30,7 +30,7 @@ This is a fork based on [style-loader](https://github.com/webpack/style-loader).

Type: `boolean`. Add `data-vue-ssr-id` attribute to injected `<style>` tags even when not in Node.js. This can be used with pre-rendering (instead of SSR) to avoid duplicate style injection on hydration.

- **attrs** (4.0.1+):
- **attributes** (4.0.1+):

Type: `object`. Add custom attribute to injected `<style>` tags.

Expand Down
10 changes: 5 additions & 5 deletions lib/addStylesClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function addStylesClient (parentId, list, _isProduction, _options
isProduction = _isProduction

options = _options || {}
options.attrs = typeof options.attrs === "object" ? options.attrs : {}
options.attributes = typeof options.attributes === "object" ? options.attributes : {}

var styles = listToStyles(parentId, list)
addStylesToDom(styles, options)
Expand Down Expand Up @@ -112,14 +112,14 @@ function addStylesToDom (styles /* Array<StyleObject> */, options) {
function createStyleElement (options) {
var styleElement = document.createElement('style')
styleElement.type = 'text/css'
addAttrs(styleElement, options.attrs);
addAttributes(styleElement, options.attributes);
head.appendChild(styleElement)
return styleElement
}

function addAttrs (el, attrs) {
Object.keys(attrs).forEach(function (key) {
el.setAttribute(key, attrs[key]);
function addAttributes (el, attributes) {
Object.keys(attributes).forEach(function (key) {
el.setAttribute(key, attributes[key]);
});
}

Expand Down

0 comments on commit c4f6cfe

Please sign in to comment.