Skip to content

entwine onunmatch doesn't fire when elements are updated #2063

@GuySartorelli

Description

@GuySartorelli

The entwine onmatch event fires when an element with the relevant selector appears in the DOM. This can be a new element, but it can also be an element being updated.

For example, with the below code, whenever a new element with the changed css class is created or an existing element gets the changed css class added to it, "match" will be printed to the console.

jQuery.entwine('ss', ($) => {
  $('.changed').entwine({
    onmatch() {
      console.log('match');
      this._super();
    },
    onremove() {
      console.log('unmatch');
      this._super();
    },
  });
});

If the element is removed from the DOM "unmatch" will be printed to the console.

However, if the changed css class is removed from the element, "unmatch" will not be printed, but it should be. This in in contrast to onremove which should only trigger when the element is explicitly removed from the DOM.

Notes

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions