Skip to content

Commit a4b25f2

Browse files
committed
Removed all for...of instances
- removed from components and docs
1 parent 5b1125a commit a4b25f2

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

docs/affixSidebar.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ export default {
3737
methods: {
3838
scrollSpy () {
3939
const scrollPosition = document.documentElement.scrollTop || document.body.scrollTop
40-
for (let s of this.sections) {
40+
this.sections.forEach(s => {
4141
// 420 = firstSection.getBoundingClientRect().top (when body.scrollTop = 0)
4242
// = nav.height + header.height + firstSection.margin-top - 6 (for offset)
4343
if (s.el.offsetTop + 420 <= scrollPosition) {
4444
this.active = s.id
4545
}
46-
}
46+
})
4747
}
4848
}
4949
}

src/Affix.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default {
3838
let element = {}
3939
const rect = this.$el.getBoundingClientRect()
4040
const body = document.body
41-
for(let type of ['Top','Left']) {
41+
['Top','Left'].forEach(type => {
4242
let t = type.toLowerCase()
4343
let ret = window['page' + (type==='Top' ? 'Y' : 'X') + 'Offset']
4444
const method = 'scroll' + type
@@ -52,7 +52,7 @@ export default {
5252
}
5353
scroll[t] = ret
5454
element[t] = scroll[t] + rect[t] - (this.$el['client'+type] || body['client'+type] || 0)
55-
}
55+
})
5656
let fix = scroll.top > element.top - this.offset
5757
if (this.affixed !== fix) { this.affixed = fix }
5858
}

src/Select.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default {
142142
selected () {
143143
if (this.options.length === 0) { return '' }
144144
let foundItems = []
145-
for (var item of this.values) {
145+
this.values.forEach(item => {
146146
if (~['number', 'string'].indexOf(typeof item)) {
147147
let option = null
148148
if (this.options.some(o => {
@@ -152,7 +152,7 @@ export default {
152152
}
153153
})) { foundItems.push(option[this.optionsLabel] || option) }
154154
}
155-
}
155+
})
156156
return foundItems.join(', ')
157157
},
158158
classes () {
@@ -275,9 +275,9 @@ export default {
275275
this.loading = true
276276
getJSON(this.url).then(data => {
277277
let options = []
278-
for (let opc of data) {
278+
data.forEach(opc => {
279279
if (opc[this.optionsValue] !== undefined && opc[this.optionsLabel] !== undefined) options.push(opc)
280-
}
280+
})
281281
this.options = options
282282
if (!options.length) { this.value = this.value instanceof Array ? [] : null }
283283
}).always(() => {

src/utils/NodeList.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ class NodeList {
9696
return this
9797
}
9898
delete () {
99-
let list = NodeListJS([], this.owner)
100-
let splice = index => ArrayProto.splice.apply()
10199
for (let i = this.length - 1, el = this[i]; i; el = this[--i]) {
102100
if (el.remove) {
103101
el.remove()
@@ -107,6 +105,7 @@ class NodeList {
107105
this.splice(i, 1)
108106
}
109107
}
108+
if (this.length) console.warn('NodeList: Some nodes could not be deleted.')
110109
return this
111110
}
112111
shift (amount) {

0 commit comments

Comments
 (0)