Skip to content

Commit 1c02f8c

Browse files
committed
use loop for resolveAsset instead of recursion
1 parent 59e00d9 commit 1c02f8c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/util/options.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,10 @@ exports.mergeOptions = function merge (parent, child, vm) {
257257
*/
258258

259259
exports.resolveAsset = function resolve (options, type, id) {
260-
return options[type][id] || (
261-
options._parent
262-
? resolve(options._parent.$options, type, id)
263-
: null
264-
)
260+
var asset = options[type][id]
261+
while (!asset && options._parent) {
262+
options = options._parent.$options
263+
asset = options[type][id]
264+
}
265+
return asset
265266
}

test/unit/specs/directives/transition_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if (_.inBrowser) {
2626
expect(dir.el.className === 'test-transition')
2727
dir.update('lol', 'test')
2828
expect(dir.el.__v_trans.id).toBe('lol')
29-
expect(dir.el.__v_trans.fns).toBeNull()
29+
expect(dir.el.__v_trans.fns).toBeUndefined()
3030
expect(dir.el.className === 'lol-transition')
3131
})
3232

0 commit comments

Comments
 (0)