-(function (Drupal, Backbone, Modernizr) {
- Drupal.contextual.VisualView = Backbone.View.extend(/** @lends Drupal.contextual.VisualView# */{
-
- /**
- * Events for the Backbone view.
- *
- * @return {object}
- * A mapping of events to be used in the view.
- */
- events() {
- // Prevents delay and simulated mouse events.
- const touchEndToClick = function (event) {
- event.preventDefault();
- event.target.click();
- };
- const mapping = {
- 'click .trigger': function () {
- this.model.toggleOpen();
- },
- 'touchend .trigger': touchEndToClick,
- 'click .contextual-links a': function () {
- this.model.close().blur();
- },
- 'touchend .contextual-links a': touchEndToClick,
- };
- // We only want mouse hover events on non-touch.
- if (!Modernizr.touchevents) {
- mapping.mouseenter = function () {
- this.model.focus();
+(function(Drupal, Backbone, Modernizr) {
+ Drupal.contextual.VisualView = Backbone.View.extend(
+ /** @lends Drupal.contextual.VisualView# */ {
+ /**
+ * Events for the Backbone view.
+ *
+ * @return {object}
+ * A mapping of events to be used in the view.
+ */
+ events() {
+ // Prevents delay and simulated mouse events.
+ const touchEndToClick = function(event) {
+ event.preventDefault();
+ event.target.click();