Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return result
}
if (currentTarget !== window && !currentTarget.contains(node)) {
return result
}
const matchEventList = eventStorage.listeners[eventName].filter(
({ identity }) => {
const { type, value } = identity
const identityMapper = attrVerify[type]
if (identityMapper && identityMapper(node, value)) {
return true
}
return false
}
)
return nodeTreeCheck(parent(node), result.concat(matchEventList))
}
// nodeTreeCheck(target).map(e => console.log(e.handler.toString()))
this.element.append(
this.$actionBar,
$selector,
this.$angle,
this.$wheel,
this.$remove
)
this.$view = query(`.${this.classes.GRADIENTBARVIEW}`, this.element)
this.$selector = query(
`.${this.classes.GRADIENTMODE}>div>span`,
this.element
)
this.SELECT = Select.of(this.$selector, {
// value: this.mode.replace(/^.?/g, match => match.toUpperCase()),
width: parent(this.$selector),
source: [
{ label: 'Linear', value: 'Linear' },
{ label: 'Radial', value: 'Radial' }
]
})
}
buildWrap() {
const $wrap = this.createElement(this.options.templates.wrap(), {
class: this.classes.WRAP
})
wrap($wrap, this.element)
this.$wrap = parent(this.element)
}
// buildData() {
setStyle('position', position, this.$wrap)
} else {
setStyle('position', 'relative', this.$wrap)
}
}
if (this.options.contentSelector) {
if (this.options.contentSelector === '>') {
this.$content = children(this.$container)[0]
} else {
this.$content = query(this.options.contentSelector, this.$container)
}
} else {
wrap('<div></div>', this.$container)
this.$content = this.$container
this.$container = parent(this.$content)
}
switch (this.options.direction) {
case 'vertical': {
this.vertical = true
break
}
case 'horizontal': {
this.horizontal = true
break
}
case 'both': {
this.horizontal = true
this.vertical = true
break
}
build() {
const that = this
this.$wrap = parent(this.element)
this.$trigger = parseHTML(
this.parseTemp('trigger', {
classes: this.classes
})
)
this.$empty = parseHTML(
this.parseTemp('empty', {
classes: this.classes,
placeholder: this.options.placeholder
})
)
this.$fill = parseHTML(
this.parseTemp('fill', {
classes: this.classes
})
initBase() {
this.$parent = parent(this.element)
this.$wrap = wrap(
template.render(this.options.templates.wrap.call(this), {
classes: this.classes
}),
this.element
)
this.clone = document.createElement('div')
this.resetCloneStyle()
append(this.clone, this.$wrap)
this.setStyle()
this.spacing = this.options.spacing
updateOverflow() {
if (this.options.overflow === false) {
return
}
const containerWidth = contentWidth(parent(this.$wrap))
const width = contentWidth(this.$wrap)
let totalWidth
const $items = []
if (this.$wrap.scrollWidth > containerWidth) {
append(this.$toggle, this.$wrap)
totalWidth = outerWidth(this.$toggle)
childrenMatchSelector('[data-value]', this.$wrap).forEach($item => {
const itemWidth = outerWidth($item)
$item.dataset.width = itemWidth
totalWidth += itemWidth
if (totalWidth > width) {
$items.push($item)
}
})
updateOverflow() {
if (this.options.overflow === false) {
return
}
const containerWidth = getWidth(parent(this.$wrap))
const width = getWidth(this.$wrap)
let totalWidth
const $items = []
if (this.$wrap.scrollWidth > containerWidth) {
append(this.$toggle, this.$wrap)
totalWidth = outerWidth(this.$toggle)
childrenMatchSelector('[data-value]', this.$wrap).forEach($item => {
const itemWidth = outerWidth($item)
setData('width', itemWidth, $item)
totalWidth += itemWidth
if (totalWidth > width) {
$items.push($item)
}
})
initWrap() {
this.$wrap = closest(this.options.wrapSelector, this.element)
if (!this.$wrap || this.$wrap !== parent(this.element)) {
this.$wrap = wrap(
template.render(this.options.templates.wrap.call(this), {
classes: this.classes
}),
this.element
)
}
}