diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 3efbb0ebf1b..f52963e436b 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -92,7 +92,6 @@ This file is generated by `grunt build`, do not edit it by hand. options: vendor: [ 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js', - 'public/docsupport/event.simulate.js' ] specs: 'spec/public/proto_specs.js' diff --git a/public/docsupport/event.simulate.js b/public/docsupport/event.simulate.js deleted file mode 100644 index 964457b8b4a..00000000000 --- a/public/docsupport/event.simulate.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Event.simulate(@element, eventName[, options]) -> Element - * - * - @element: element to fire event on - * - eventName: name of event to fire (only MouseEvents and HTMLEvents interfaces are supported) - * - options: optional object to fine-tune event properties - pointerX, pointerY, ctrlKey, etc. - * - * $('foo').simulate('click'); // => fires "click" event on an element with id=foo - * - **/ -(function(){ - - var eventMatchers = { - 'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/, - 'MouseEvents': /^(?:click|dblclick|mouse(?:down|up|over|move|out))$/ - } - var defaultOptions = { - pointerX: 0, - pointerY: 0, - button: 0, - ctrlKey: false, - altKey: false, - shiftKey: false, - metaKey: false, - bubbles: true, - cancelable: true - } - - Event.simulate = function(element, eventName) { - var options = Object.extend(Object.clone(defaultOptions), arguments[2] || { }); - var oEvent, eventType = null; - - element = $(element); - - for (var name in eventMatchers) { - if (eventMatchers[name].test(eventName)) { eventType = name; break; } - } - - if (!eventType) - throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported'); - - if (document.createEvent) { - oEvent = document.createEvent(eventType); - if (eventType == 'HTMLEvents') { - oEvent.initEvent(eventName, options.bubbles, options.cancelable); - } - else { - oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView, - options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY, - options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element); - } - element.dispatchEvent(oEvent); - } - else { - options.clientX = options.pointerX; - options.clientY = options.pointerY; - oEvent = Object.extend(document.createEventObject(), options); - element.fireEvent('on' + eventName, oEvent); - } - return element; - } - - Element.addMethods({ simulate: Event.simulate }); -})(); \ No newline at end of file diff --git a/public/options.html b/public/options.html index 412101d0f5c..7e54a2e5a03 100644 --- a/public/options.html +++ b/public/options.html @@ -229,7 +229,7 @@
Chosen triggers the standard DOM event whenever a selection is made (it also sends a selected
or deselected
parameter that tells you which option was changed).
Note: in order to use change in the Prototype version, you have to include the Event.simulate class. The selected and deselected parameters are not available for Prototype.
+The selected and deselected parameters are not available for Prototype.