Skip to content

Commit

Permalink
Merge pull request #261 from slevp/master
Browse files Browse the repository at this point in the history
fix 'dataset' in IE10,9
  • Loading branch information
hilongjw authored Jun 3, 2018
2 parents 8bae1db + 68f2f28 commit 7d3139e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-lazyload",
"version": "1.2.3",
"version": "1.2.4",
"description": "Vue module for lazy-loading images in your vue.js applications.",
"main": "vue-lazyload.js",
"unpkg": "vue-lazyload.js",
Expand Down
6 changes: 3 additions & 3 deletions src/lazy-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class LazyContainer {
imgs.forEach(el => {
this.lazy.add(el, assign({}, this.binding, {
value: {
src: el.dataset.src,
error: el.dataset.error,
loading: el.dataset.loading
src: 'dataset' in el ? el.dataset.src : el.getAttribute('data-src'),
error: 'dataset' in el ? el.dataset.error : el.getAttribute('data-error'),
loading: 'dataset' in el ? el.dataset.loading : el.getAttribute('data-loading')
}
}), this.vnode)
})
Expand Down
7 changes: 6 additions & 1 deletion src/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ export default class ReactiveListener {
* @return
*/
initState () {
this.el.dataset.src = this.src
if ('dataset' in this.el) {
this.el.dataset.src = this.src
} else {
this.el.setAttribute('data-src', this.src)
}

this.state = {
error: false,
loaded: false,
Expand Down
4 changes: 2 additions & 2 deletions vue-lazyload.js

Large diffs are not rendered by default.

0 comments on commit 7d3139e

Please sign in to comment.