replacement of button_to_function to avoid DEPRECATION WARNING.

 When the js is called just once, onClick is simpler than
 unobtrusive-javascript approach.
192746
def button_for_js(label, js, html_options={})
      tag(:input, {type: 'button', value: label, onClick: js}.merge(
        html_options))
    end
1331679
function (e) {

/*Line 17 - 'AtomButton.js' */                AtomUI.cancelEvent(e);

/*Line 19 - 'AtomButton.js' */                if (this._next) {
/*Line 20 - 'AtomButton.js' */                    if (this._sendData && this._next) {
/*Line 21 - 'AtomButton.js' */                        AtomBinder.setValue(this._next, "data", this.get_data());
/*Line 22 - 'AtomButton.js' */                    }
/*Line 23 - 'AtomButton.js' */                    this.invokeAction(this._next);
/*Line 24 - 'AtomButton.js' */                }
/*Line 25 - 'AtomButton.js' */                return false;
/*Line 26 - 'AtomButton.js' */            }
749914
def js_on_click(self, handler):
        '''  '''
        self.js_on_event(ButtonClick, handler)
        self.js_on_event(MenuItemClick, handler)
141116
function (obj) {
            var cmenu = this;
            var label = obj.label;
            if (typeof obj === "function") {
                obj = {onclick: obj};
            } // If passed a simple function, turn it into a property of an object
            // Default properties, extended in case properties are passed
            var o = $.extend({
                onclick: function () {
                },
                className: '',
                hoverClassName: cmenu.itemHoverClassName,
                icon: '',
                disabled: false,
                title: '',
                hoverItem: cmenu.hoverItem,
                hoverItemOut: cmenu.hoverItemOut
            }, obj);
            // If an icon is specified, hard-code the background-image style. Themes that don't show images should take this into account in their CSS
            var iconStyle = (o.icon) ? 'background-image:url(' + o.icon + ');' : '';
            var $div = $('<div class="' + cmenu.itemClassName + ' ' + o.className + ((o.disabled) ? ' ' + cmenu.disabledItemClassName : '') + '" title="' + o.title + '"></div>')
            // If the item is disabled, don't do anything when it is clicked
                .click(
                    function (e) {
                        if (cmenu.isItemDisabled(this)) {
                            return false;
                        }
                        else {
                            return o.onclick.call(cmenu.target, this, cmenu, e, label);
                        }
                    }
                )
                // Change the class of the item when hovered over
                .hover(
                    function () {
                        o.hoverItem.call(this, (cmenu.isItemDisabled(this)) ? cmenu.disabledItemHoverClassName : o.hoverClassName);
                    }
                    , function () {
                        o.hoverItemOut.call(this, (cmenu.isItemDisabled(this)) ? cmenu.disabledItemHoverClassName : o.hoverClassName);
                    }
                );
            var $idiv = $('<div class="' + cmenu.innerDivClassName + '" style="' + iconStyle + '">' + label + '</div>');
            $div.append($idiv);
            return $div;
        }
1112548
function createActionButton (title, callback, appendTo) {
    appendTo = appendTo || 'buttons';
    var buttons = document.getElementById(appendTo);
    var div = document.createElement('div');
    var button = document.createElement('a');
    button.textContent = title;
    button.onclick = function (e) {
        e.preventDefault();
        callback();
    };
    button.classList.add('topcoat-button');
    div.appendChild(button);
    buttons.appendChild(div);
}
743194
function once(evt, handler) {
            var thisArg = arguments[2] === undefined ? null : arguments[2];

            var wrapper = undefined,
                self = this;
            // add a wrapper around the handler and listen to the requested event
            this.on(evt, wrapper = function () {
                for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
                    args[_key4] = arguments[_key4];
                }

                try {
                    handler.apply.apply(handler, [thisArg].concat(args));
                } catch (err) {
                    console.error("ONCE handler received an error: " + err.message + ", " + JSON.stringify(err));
                } finally {
                    // remove the wrapper so that the event doesn't call us again
                    self.off(evt, wrapper, thisArg);
                }
            }, thisArg);
        }
808543
function patchUncaught() {
  var name = 'uncaughtException';
  var originalListener = process.listeners(name).pop();

  if (originalListener) {
    process.removeListener(name, originalListener);
  }

  return function() {
    if (!originalListener) return;
    process.on(name, originalListener);
  };
}
534021
function() {
       
      var buttonConf, button, i, buttonsNb = this.options.buttons.length;
      
      this.buttonDiv = inputEx.cn('div', {className: 'inputEx-Form-buttonBar'});

      for(i = 0 ; i < buttonsNb ; i++ ) {
         buttonConf = this.options.buttons[i];
   
         // Throw Error if button is undefined
         if(!buttonConf) {
            throw new Error("inputEx.Form: One of the provided button is undefined ! (check trailing comma)");
         }
         
         button = new inputEx.widget.Button(buttonConf);
         button.render(this.buttonDiv);
         
         this.buttons.push(button);
         
      }
      
      // useful for link buttons re-styling (float required on <a>'s ... )
      this.buttonDiv.appendChild(inputEx.cn('div',null,{clear:'both'}));
      
      this.form.appendChild(this.buttonDiv);
   }
1230793
function (searchbar) {
        var that = this;
        var button = searchbar.querySelector('button[type=submit]');
        var search = searchbar.querySelector('input[type=search]');

        if (typeof button === 'undefined') {
            return searchbar;
        }

        button.onclick = function (ev) {
            ev.preventDefault();
            that.emitter.emit('search-request', search);
        };

        return searchbar;
    }
33030
function() {
			if (this.$buttonContainer && Array.isArray(this.buttons)) {
				var self = this;
				this.buttons.forEach(function(buttonDefinition) {
					var button = uiUtil.createButton(buttonDefinition.text, buttonDefinition.callback);
					if (buttonDefinition.id) {
						button.id = buttonDefinition.id;
						self['$'+ button.id] = button; //$NON-NLS-0$					
					}
					if (buttonDefinition.isDefault) {
						self._defaultCallback = buttonDefinition.callback;
						self._defaultButton = button;
						button.classList.add("primaryButton"); //$NON-NLS-0$
					}
					self.$buttonContainer.appendChild(button);
				});
			}
		}
866681
function _onKeyEvent(instance, event) {
            self.trigger("keyEvent", self, event);  // deprecated
            self.trigger(event.type, self, event);
            return event.defaultPrevented;   // false tells CodeMirror we didn't eat the event
        }
500440
function toggleButton( evt ){

    target = evt.target;
    while ( target && !target.getAttribute( toggleMethod ) ){
      target = target.parentNode;
      if(!target) { return; }
    }

    currentState = target.getAttribute( menuState ) === isOpen ? isClosed : isOpen;

    target.setAttribute(menuState, currentState);
   
  }
688166
public void considerDoubleClick(int button, int x, int y) {
		if (doubleClickTimeout == 0) {
			clickX = x;
			clickY = y;
			clickButton = button;
			doubleClickTimeout = System.currentTimeMillis() + doubleClickDelay;
			fireMouseClicked(button, x, y, 1);
		} else {
			if (clickButton == button) {
				if ((System.currentTimeMillis() < doubleClickTimeout)) {
					fireMouseClicked(button, x, y, 2);
					doubleClickTimeout = 0;
				}
			}
		}
	}
1308210
function preventGhostClick(event) {

    var ev = event.originalEvent || event;
    //don't prevent fastclicks
    if (ev.fastclick) { return true; }

    for (var i = 0; i < coordinates.length; i++) {
      var x = coordinates[i][0];
      var y = coordinates[i][1];

      // within the range, so prevent the click
      if (Math.abs(ev.clientX - x) < threshold && Math.abs(ev.clientY - y) < threshold) {
        event.stopPropagation();
        event.stopImmediatePropagation();
        event.preventDefault();
        return false;
      }
    }

  }
107213
def click_event(self, event):
        
        # we can prevent request that a refresh after the event has happened
        # by setting this to True.  Modules should do this via
        # py3.prevent_refresh()
        self.prevent_refresh = False
        try:
            if self.error_messages:
                # we have error messages
                button = event["button"]
                if button == 1:
                    # cycle through to next message
                    self.error_index = (self.error_index + 1) % len(self.error_messages)
                    error = self.error_messages[self.error_index]
                    self.error_output(error)
                if button == 3:
                    self.hide_errors()
                if button != 2 or (self.terminated or self.disabled):
                    self.prevent_refresh = True

            elif self.click_events:
                click_method = getattr(self.module_class, "on_click")
                if self.click_events == self.PARAMS_NEW:
                    # new style modules
                    click_method(event)
                else:
                    # legacy modules had extra parameters passed
                    click_method(
                        self.i3status_thread.json_list,
                        self.config["py3_config"]["general"],
                        event,
                    )
                self.set_updated()
            else:
                # nothing has happened so no need for refresh
                self.prevent_refresh = True
        except Exception:
            msg = "on_click event in `{}` failed".format(self.module_full_name)
            self._py3_wrapper.report_exception(msg)
640283
def press(button, scope={})
      in_scope(scope) do
        begin
          click_button(button)
        rescue Capybara::ElementNotFound
          raise Kelp::MissingButton,
            "No button with value, id or text '#{button}' found"
        end
      end
    end
837248
function handleKeydown(originalEvent) {
    eventUtils.handleActionKeydown(originalEvent, () => {
        this.handleClick(originalEvent);
    });
    eventUtils.handleEscapeKeydown(originalEvent, () => {
        if (!this.state.disabled) {
            emitAndFire(this, 'button-escape', { originalEvent });
        }
    });
}