How to use the @pluginjs/dom.parent function in @pluginjs/dom

To help you get started, we’ve selected a few @pluginjs/dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pluginjs / pluginjs / modules / utils / events / src / eventStorage.js View on Github external
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()))
github pluginjs / pluginjs / modules / color-selector / src / components / gradient.js View on Github external
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' }
      ]
    })
  }
github pluginjs / pluginjs / modules / edit-panel / src / main.js View on Github external
buildWrap() {
    const $wrap = this.createElement(this.options.templates.wrap(), {
      class: this.classes.WRAP
    })
    wrap($wrap, this.element)
    this.$wrap = parent(this.element)
  }
  // buildData() {
github pluginjs / pluginjs / modules / scrollable / src / main.js View on Github external
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
      }
github pluginjs / pluginjs / modules / link-picker / src / main.js View on Github external
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
      })
github pluginjs / pluginjs / modules / sticky / src / stickyType / base.js View on Github external
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
github pluginjs / pluginjs / modules / choice / src / main.js View on Github external
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)
        }
      })
github pluginjs / pluginjs / modules / choice / src / main.js View on Github external
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)
        }
      })
github pluginjs / pluginjs / modules / sticky / src / main.js View on Github external
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
      )
    }
  }