Skip to content

Commit

Permalink
Use 0 instead of -1 for event property fallbacks.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdotdesign committed Nov 18, 2024
1 parent 3205d9a commit ed38e9f
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions runtime/src/normalize_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,76 +62,76 @@ export const normalizeEvent = (event) => {
case "altKey":
return false;
case "charCode":
return -1;
return 0;
case "ctrlKey":
return false;
case "key":
return "";
case "keyCode":
return -1;
return 0;
case "locale":
return "";
case "location":
return -1;
return 0;
case "metaKey":
return false;
case "repeat":
return false;
case "shiftKey":
return false;
case "which":
return -1;
return 0;

// onClick onContextMenu onDoubleClick onDrag onDragStart onDragEnd
// onDragEnter onDragExit onDragLeave onDragOver onDrop onMouseDown
// onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver
// onMouseUp
case "button":
return -1;
return -1; // 0 is the left button
case "buttons":
return -1;
return 0;
case "clientX":
return -1;
return 0;
case "clientY":
return -1;
return 0;
case "pageX":
return -1;
return 0;
case "pageY":
return -1;
return 0;
case "screenX":
return -1;
return 0;
case "screenY":
return -1;
return 0;
case "layerX":
return -1;
return 0;
case "layerY":
return -1;
return 0;
case "offsetX":
return -1;
return 0;
case "offsetY":
return -1;
return 0;

// onScroll
case "detail":
return -1;
return 0;

// onWheel
case "deltaMode":
return -1;
return -1; // 0 is pixels
case "deltaX":
return -1;
return 0;
case "deltaY":
return -1;
return 0;
case "deltaZ":
return -1;
return 0;

// onAnimationStart onAnimationEnd onAnimationIteration
case "animationName":
return "";
case "pseudoElement":
return "";
case "elapsedTime":
return -1;
return 0;

// onTransitionEnd
case "propertyName":
Expand Down

0 comments on commit ed38e9f

Please sign in to comment.