javascript lib MDL-23224 dropdown onclick event is not trigger in Chrome
authorjeromemoodle <jerome@moodle.com>
Wed, 5 Jan 2011 08:12:52 +0000 (16:12 +0800)
committerjeromemoodle <jerome@moodle.com>
Wed, 5 Jan 2011 08:12:52 +0000 (16:12 +0800)
lib/javascript-static.js

index d79230d..94dd7e0 100644 (file)
@@ -365,7 +365,12 @@ M.util.init_select_autosubmit = function(Y, formid, selectid, nothing) {
                 // event.... usability
                 Y.on('key', processchange, select, 'press:13', form, select.get('selectedIndex'));
                 select.on('blur', processchange, form, select.get('selectedIndex'));
                 // event.... usability
                 Y.on('key', processchange, select, 'press:13', form, select.get('selectedIndex'));
                 select.on('blur', processchange, form, select.get('selectedIndex'));
-                select.on('click', processchange, form, select.get('selectedIndex'));
+                //little hack for chrome that need onChange event instead of onClick - see MDL-23224
+                if (Y.UA.webkit) {
+                    select.on('change', processchange, form, select.get('selectedIndex'));
+                } else {
+                    select.on('click', processchange, form, select.get('selectedIndex'));
+                }
             }
         }
     });
             }
         }
     });