🙈 Add temporary hack to work around issue with CustomEvent

Since it's no longer possible to "properly" extend CustomEvent, we will need to
figure out a way to shadow the prototype chain, or some such.

See https://code.google.com/p/chromium/issues/detail?id=495437 for more details.
This commit is contained in:
Thomas Johansen
2015-07-28 22:47:10 +02:00
parent 93348f7e3f
commit 405eaf14d1

View File

@@ -220,6 +220,7 @@ class CommandRegistry
syntheticEvent = Object.create {},
eventPhase: value: Event.BUBBLING_PHASE
currentTarget: get: -> currentTarget
target: value: currentTarget # TODO: Find a better way to solve this.
preventDefault: value: ->
originalEvent.preventDefault()
stopPropagation: value: ->
@@ -232,6 +233,7 @@ class CommandRegistry
abortKeyBinding: value: ->
originalEvent.abortKeyBinding?()
# In Chrome 43, Object.create doesn't work well with CustomEvent.
# NOTE: We should "properly" shadow the prototype chain (CustomEvent + Event) here.
for k, v of originalEvent when k not in syntheticEvent
syntheticEvent[k] = v