这是indexloc提供的服务,不要输入任何密码
Skip to content

replaceElement API Issue cause click function fired multiple #194

@kopigreenx

Description

@kopigreenx

I found an issue in the replaceElemet function
if you run this function, the click function will be executed according to the accumulation of how many times we click inside the same element

this.replaceElement = function (el, element) {
      var nodeItem = el
      if (typeof nodeItem === 'string') {
        nodeItem = self.element.querySelector('[data-eid="' + el + '"]')
      }
      nodeItem.innerHTML = __buildItemCard(element)
      // add function
      nodeItem.clickfn = element.click
      nodeItem.contextfn = element.context
      nodeItem.dragfn = element.drag
      nodeItem.dragendfn = element.dragend
      nodeItem.dropfn = element.drop
      __appendCustomProperties(nodeItem, element)
      __onclickHandler(nodeItem) // <== this line makes the click event appear based on how many times you replace the same element
      __onContextHandler(nodeItem)
      return self
    }

when I disable the line above the click function runs normally disable this line

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions