Skip to content

Commit 7323a0e

Browse files
committed
Merge pull request #2499 from kazupon/refactor/directives
fix: directive I/F consistency
2 parents 0227f96 + 58e846e commit 7323a0e

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/directives/public/for.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const vFor = {
3030
'leave-stagger'
3131
],
3232

33-
bind: function () {
33+
bind () {
3434
// support "item in/of items" syntax
3535
var inMatch = this.expression.match(/(.*) (?:in|of) (.*)/)
3636
if (inMatch) {
@@ -78,7 +78,7 @@ const vFor = {
7878
this.factory = new FragmentFactory(this.vm, this.el)
7979
},
8080

81-
update: function (data) {
81+
update (data) {
8282
this.diff(data)
8383
this.updateRef()
8484
this.updateModel()
@@ -98,7 +98,7 @@ const vFor = {
9898
* @param {Array} data
9999
*/
100100

101-
diff: function (data) {
101+
diff (data) {
102102
// check if the Array was converted from an Object
103103
var item = data[0]
104104
var convertedFromObject = this.fromObject =
@@ -224,7 +224,7 @@ const vFor = {
224224
* @return {Fragment}
225225
*/
226226

227-
create: function (value, alias, index, key) {
227+
create (value, alias, index, key) {
228228
var host = this._host
229229
// create iteration scope
230230
var parentScope = this._scope || this.vm
@@ -258,7 +258,7 @@ const vFor = {
258258
* Update the v-ref on owner vm.
259259
*/
260260

261-
updateRef: function () {
261+
updateRef () {
262262
var ref = this.descriptor.ref
263263
if (!ref) return
264264
var hash = (this._scope || this.vm).$refs
@@ -279,7 +279,7 @@ const vFor = {
279279
* parent <select>.
280280
*/
281281

282-
updateModel: function () {
282+
updateModel () {
283283
if (this.isOption) {
284284
var parent = this.start.parentNode
285285
var model = parent && parent.__v_model
@@ -298,7 +298,7 @@ const vFor = {
298298
* @param {Boolean} inDocument
299299
*/
300300

301-
insert: function (frag, index, prevEl, inDocument) {
301+
insert (frag, index, prevEl, inDocument) {
302302
if (frag.staggerCb) {
303303
frag.staggerCb.cancel()
304304
frag.staggerCb = null
@@ -334,7 +334,7 @@ const vFor = {
334334
* @param {Boolean} inDocument
335335
*/
336336

337-
remove: function (frag, index, total, inDocument) {
337+
remove (frag, index, total, inDocument) {
338338
if (frag.staggerCb) {
339339
frag.staggerCb.cancel()
340340
frag.staggerCb = null
@@ -365,7 +365,7 @@ const vFor = {
365365
* @param {Node} prevEl
366366
*/
367367

368-
move: function (frag, prevEl) {
368+
move (frag, prevEl) {
369369
// fix a common issue with Sortable:
370370
// if prevEl doesn't have nextSibling, this means it's
371371
// been dragged after the end anchor. Just re-position
@@ -386,7 +386,7 @@ const vFor = {
386386
* @param {String} [key]
387387
*/
388388

389-
cacheFrag: function (value, frag, index, key) {
389+
cacheFrag (value, frag, index, key) {
390390
var trackByKey = this.params.trackBy
391391
var cache = this.cache
392392
var primitive = !isObject(value)
@@ -428,7 +428,7 @@ const vFor = {
428428
* @return {Fragment}
429429
*/
430430

431-
getCachedFrag: function (value, index, key) {
431+
getCachedFrag (value, index, key) {
432432
var trackByKey = this.params.trackBy
433433
var primitive = !isObject(value)
434434
var frag
@@ -455,7 +455,7 @@ const vFor = {
455455
* @param {Fragment} frag
456456
*/
457457

458-
deleteCachedFrag: function (frag) {
458+
deleteCachedFrag (frag) {
459459
var value = frag.raw
460460
var trackByKey = this.params.trackBy
461461
var scope = frag.scope
@@ -486,7 +486,7 @@ const vFor = {
486486
* @param {String} type
487487
*/
488488

489-
getStagger: function (frag, index, total, type) {
489+
getStagger (frag, index, total, type) {
490490
type = type + 'Stagger'
491491
var trans = frag.node.__v_trans
492492
var hooks = trans && trans.hooks
@@ -501,7 +501,7 @@ const vFor = {
501501
* filters. This is passed to and called by the watcher.
502502
*/
503503

504-
_preProcess: function (value) {
504+
_preProcess (value) {
505505
// regardless of type, store the un-filtered raw value.
506506
this.rawValue = value
507507
return value
@@ -516,7 +516,7 @@ const vFor = {
516516
* the v-for to update when the source Object is mutated.
517517
*/
518518

519-
_postProcess: function (value) {
519+
_postProcess (value) {
520520
if (isArray(value)) {
521521
return value
522522
} else if (isPlainObject(value)) {
@@ -541,7 +541,7 @@ const vFor = {
541541
}
542542
},
543543

544-
unbind: function () {
544+
unbind () {
545545
if (this.descriptor.ref) {
546546
(this._scope || this.vm).$refs[this.descriptor.ref] = null
547547
}

src/directives/public/if.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default {
5757
this.frag.before(this.anchor)
5858
},
5959

60-
remove: function () {
60+
remove () {
6161
if (this.frag) {
6262
this.frag.remove()
6363
this.frag = null
@@ -74,7 +74,7 @@ export default {
7474
}
7575
},
7676

77-
unbind: function () {
77+
unbind () {
7878
if (this.frag) {
7979
this.frag.destroy()
8080
}

0 commit comments

Comments
 (0)