necouchman commented on code in PR #996:
URL: https://github.com/apache/guacamole-client/pull/996#discussion_r1674380193


##########
guacamole-common-js/src/main/webapp/modules/Mouse.js:
##########
@@ -258,9 +258,15 @@ Guacamole.Mouse = function Mouse(element) {
 
     }
 
-    element.addEventListener('DOMMouseScroll', mousewheel_handler, false);
-    element.addEventListener('mousewheel',     mousewheel_handler, false);
-    element.addEventListener('wheel',          mousewheel_handler, false);
+    if (window.WheelEvent) {
+        // All modern browsers support wheel events.
+        element.addEventListener('wheel',          mousewheel_handler, false);
+    } else {

Review Comment:
   Please don't cuddle the braces...
   ```
   {
   else {
   ```



##########
guacamole-common-js/src/main/webapp/modules/Mouse.js:
##########
@@ -258,9 +258,15 @@ Guacamole.Mouse = function Mouse(element) {
 
     }
 
-    element.addEventListener('DOMMouseScroll', mousewheel_handler, false);
-    element.addEventListener('mousewheel',     mousewheel_handler, false);
-    element.addEventListener('wheel',          mousewheel_handler, false);
+    if (window.WheelEvent) {
+        // All modern browsers support wheel events.
+        element.addEventListener('wheel',          mousewheel_handler, false);

Review Comment:
   Because these lines are now separated by `if/else` blocks and comments, I 
don't know that there's any reason to have all of the extra spaces between the 
`'wheel',` and the `mousewheel_handler` - both this line, and below.



##########
guacamole-common-js/src/main/webapp/modules/Mouse.js:
##########
@@ -258,9 +258,15 @@ Guacamole.Mouse = function Mouse(element) {
 
     }
 
-    element.addEventListener('DOMMouseScroll', mousewheel_handler, false);
-    element.addEventListener('mousewheel',     mousewheel_handler, false);
-    element.addEventListener('wheel',          mousewheel_handler, false);
+    if (window.WheelEvent) {
+        // All modern browsers support wheel events.
+        element.addEventListener('wheel',          mousewheel_handler, false);
+    } else {

Review Comment:
   Please don't cuddle the braces...
   ```
   }
   else {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to