Skip to content

Commit

Permalink
* core: refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Aug 30, 2024
1 parent dce069c commit d9990bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/core/src/helpers/global-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function handleGlobalEvent(this: Cash, event: Event) {
const zuiOn = $element.attr('zui-on');
if (zuiOn) {
const [events, code] = zuiOn.split('~').map(x => x.trim());
if (events) {
if (events && events.split(' ').includes(type)) {
processGlobalEvent($element, event, $.extend({
on: events,
}, code ? (code.startsWith('{') ? evalValue(code) : {do: code}) : getZData($element, {prefix: 'data-', evalValue: ['call', 'if', 'do']})));
Expand All @@ -138,7 +138,7 @@ function handleGlobalEvent(this: Cash, event: Event) {
}

const dataOn = $element.attr('data-on');
if (dataOn) {
if (dataOn && dataOn.split(' ').includes(type)) {
processGlobalEvent($element, event, getZData($element, {prefix: 'data-', evalValue: ['call', 'if', 'do']}) as GlobalEventOptions);
}
}
Expand Down

0 comments on commit d9990bb

Please sign in to comment.