Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
reInstantiateList () {
if (this.js) {
if (this.mdcList) {
this.mdcList.destroy()
}
MDCList.attachTo(this.$el)
this.mdcList.singleSelection = this.singleSelection
this.mdcList.vertical = this.vertical
this.mdcList.selectedIndex = this.selectedIndex
this.mdcList.wrapFocus = this.wrapFocus
} else {
if (this.mdcList) {
this.mdcList.destroy()
}
this.mdcList = undefined
}
},
updateSlot () {
this.$nextTick(() => {
if (this.js && !this.mdcList) {
this.mdcList = MDCList.attachTo(this.$el)
this.mdcList.singleSelection = this.singleSelection
if (this.singleSelection) this.$el.setAttribute('role', 'listbox')
this.mdcList.vertical = this.vertical
if ((this.selectedIndex instanceof Number && this.selectedIndex > -1) || this.selectedIndex instanceof Array) this.mdcList.selectedIndex = this.selectedIndex
this.mdcList.wrapFocus = this.wrapFocus
this.slotObserver = new MutationObserver(() => this.updateSlot())
this.slotObserver.observe(this.$el, {
childList: true,
subtree: true
})
}
})
},