* Synthetic events are dispatched by event plugins, typically in response to a * top-level event delegation handler. * * These systems should generally use pooling to reduce the frequency of garbage * collection. The system should check `isPersistent` to determine whether the * event
(dispatchConfig, targetInst, nativeEvent, nativeEventTarget)
| 8495 | |
| 8496 | |
| 8497 | function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { |
| 8498 | { |
| 8499 | // these have a getter/setter for warnings |
| 8500 | delete this.nativeEvent; |
| 8501 | delete this.preventDefault; |
| 8502 | delete this.stopPropagation; |
| 8503 | delete this.isDefaultPrevented; |
| 8504 | delete this.isPropagationStopped; |
| 8505 | } |
| 8506 | |
| 8507 | this.dispatchConfig = dispatchConfig; |
| 8508 | this._targetInst = targetInst; |
| 8509 | this.nativeEvent = nativeEvent; |
| 8510 | var Interface = this.constructor.Interface; |
| 8511 | |
| 8512 | for (var propName in Interface) { |
| 8513 | if (!Interface.hasOwnProperty(propName)) { |
| 8514 | continue; |
| 8515 | } |
| 8516 | |
| 8517 | { |
| 8518 | delete this[propName]; // this has a getter/setter for warnings |
| 8519 | } |
| 8520 | |
| 8521 | var normalize = Interface[propName]; |
| 8522 | |
| 8523 | if (normalize) { |
| 8524 | this[propName] = normalize(nativeEvent); |
| 8525 | } else { |
| 8526 | if (propName === 'target') { |
| 8527 | this.target = nativeEventTarget; |
| 8528 | } else { |
| 8529 | this[propName] = nativeEvent[propName]; |
| 8530 | } |
| 8531 | } |
| 8532 | } |
| 8533 | |
| 8534 | var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; |
| 8535 | |
| 8536 | if (defaultPrevented) { |
| 8537 | this.isDefaultPrevented = functionThatReturnsTrue; |
| 8538 | } else { |
| 8539 | this.isDefaultPrevented = functionThatReturnsFalse; |
| 8540 | } |
| 8541 | |
| 8542 | this.isPropagationStopped = functionThatReturnsFalse; |
| 8543 | return this; |
| 8544 | } |
| 8545 | |
| 8546 | _assign(SyntheticEvent.prototype, { |
| 8547 | preventDefault: function () { |
nothing calls this directly
no test coverage detected