-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
When we need to execute the $().cssParentSelector(); more than once (e.g. some dynamic content is built, or some html is received from the server). We end up with multiple handlers for the same event therefore toggling in pair so it won't do nothing.
To solve this i used an annotation in the element to it won't be affected more than once to the same event.
!state ? toggleFn() : $(this).on(this_state, toggleFn);Replaced with
// If there's no subject then don't register the handler on the event observer.
if ($(subject).size() === 0) {
return;
}
var $this = $(this);
var this_state = stateMap[state] || state;
if (($this.attr('data-parent-selector') || "").indexOf(this_state) === -1) {
$this.attr('data-parent-selector', ($this.attr('data-parent-selector') || "") + this_state);
!state ? toggleFn() : $(this).on(this_state, toggleFn);
}This could be improved because if two rules (e.g. two ! > :focus rules) are declared only one will be affected. For now this solves my problem.
Metadata
Metadata
Assignees
Labels
No labels