Skip to content

Commit d567a96

Browse files
committed
changed handling and detection of multiple entries
1 parent c2f6df3 commit d567a96

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

dist/breinify-activities.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,12 @@
487487
$el.data(this.marker.elementData, currentData);
488488
}
489489

490-
$el.attr('data-' + this.marker.activate, 'true');
490+
// check the current marker on the element
491+
const attrObserverActive = 'data-' + this.marker.activate;
492+
const observerActive = Breinify.UTL.isNonEmptyString($el.attr(attrObserverActive));
493+
if (observerActive === null) {
494+
$el.attr('data-' + this.marker.activate, 'true');
495+
}
491496

492497
// evaluate directly (not on bound or observing dom-event) if needed
493498
if (normalizedSettings.evaluateOnSetup === true) {
@@ -633,13 +638,7 @@
633638
const $selectedEls = $.isFunction(additionalMutationObserverSettings.onElementSelection) ? additionalMutationObserverSettings.onElementSelection($el) : $el;
634639

635640
$selectedEls.each(function () {
636-
const $selectedEl = $(this);
637-
const observerActive = $selectedEl.attr('data-' + _self.marker.activate);
638-
639-
// check if the element is activated already, if so we do not need to do anything
640-
if (typeof observerActive !== 'string' || observerActive.trim() === '') {
641-
_self.setupObservableDomElement($selectedEl, observerType, settings, data);
642-
}
641+
_self.setupObservableDomElement($(this), observerType, settings, data);
643642
});
644643
} else {
645644
$el.find(selector).each(function () {

0 commit comments

Comments
 (0)