Skip to content

Commit

Permalink
Allow setting originalEvent in Element.emit
Browse files Browse the repository at this point in the history
  • Loading branch information
somebee committed Apr 11, 2024
1 parent eaea5f5 commit f634549
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/imba/src/imba/dom/core.web.imba
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,17 @@ extend class Element
get focin?
contains(document.activeElement)

def emit name, detail\any?, o = {bubbles: true, cancelable: true, detail: null}
o.detail = detail if detail != undefined
def emit name\string, detail\any?, o = {}
if detail != undefined
o.detail ??= detail
o.bubbles ??= true
o.cancelable ??= true

let event = new CustomEvent(name, o)

if o.original
event.originalEvent = o.original

let res = self.dispatchEvent(event)
return event

Expand Down

0 comments on commit f634549

Please sign in to comment.