Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replaceElement API Issue cause click function fired multiple #194

Open
kopigreenx opened this issue Oct 24, 2023 · 0 comments
Open

replaceElement API Issue cause click function fired multiple #194

kopigreenx opened this issue Oct 24, 2023 · 0 comments

Comments

@kopigreenx
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant