Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Class events should now be used without their on prefix, i.e. addE…

…vent('onChainComplete', fn) becomes addEvent('chainComplete'). If you want to add events in the options you need to prefix them with 'on' now ('foo' -> 'onFoo').

Note: This is not a breaking change.

- other minor optimizations and doc fixes

git-svn-id: http://svn.mootools.net/trunk@1546 4db308c1-fb21-0410-9919-de62e267375e
  • Loading branch information...
commit a50de50b7f6f83beb053a0f75eb3e3e6381d2b12 1 parent f0eca8e
JanK authored subtleGradient committed
Showing with 142 additions and 130 deletions.
  1. +1 −1  Compatibility/Request/Request.JSON.js
  2. +1 −1  Compatibility/Request/Request.js
  3. +4 −4 Demos/Fx.Slide/demo.js
  4. +1 −1  Demos/Sortables/index.html
  5. +20 −17 Docs/Class/Class.Extras.md
  6. +6 −6 Docs/Fx/Fx.md
  7. +2 −2 Docs/Plugins/Accordion.md
  8. +3 −3 Docs/Plugins/Drag.Move.md
  9. +6 −6 Docs/Plugins/Drag.md
  10. +2 −2 Docs/Plugins/Group.md
  11. +1 −1  Docs/Plugins/Scroller.md
  12. +5 −5 Docs/Plugins/Slider.md
  13. +3 −3 Docs/Plugins/Sortables.md
  14. +8 −8 Docs/Plugins/Tips.md
  15. +1 −1  Docs/Request/Request.HTML.md
  16. +6 −6 Docs/Request/Request.md
  17. +1 −1  Docs/Utilities/Swiff.md
  18. +9 −0 Source/Class/Class.Extras.js
  19. +4 −4 Source/Core/Core.js
  20. +4 −4 Source/Fx/Fx.js
  21. +2 −2 Source/Plugins/Accordion.js
  22. +4 −4 Source/Plugins/Drag.Move.js
  23. +5 −5 Source/Plugins/Drag.js
  24. +2 −2 Source/Plugins/Fx.Scroll.js
  25. +1 −1  Source/Plugins/Fx.Slide.js
  26. +2 −2 Source/Plugins/Scroller.js
  27. +4 −4 Source/Plugins/Slider.js
  28. +1 −1  Source/Plugins/SmoothScroll.js
  29. +3 −3 Source/Plugins/Sortables.js
  30. +2 −2 Source/Plugins/Tips.js
  31. +5 −5 Source/Request/Request.js
  32. +23 −23 Specs/Class/Class.Extras.js
View
2  Compatibility/Request/Request.JSON.js
@@ -18,7 +18,7 @@ JSON.Remote = new Class({
},
failure: function(){
- this.fireEvent('onFailure', this.xhr);
+ this.fireEvent('failure', this.xhr);
}
});
View
2  Compatibility/Request/Request.js
@@ -29,7 +29,7 @@ var XHR = new Class({
},
failure: function(){
- this.fireEvent('onFailure', this.xhr);
+ this.fireEvent('failure', this.xhr);
}
});
View
8 Demos/Fx.Slide/demo.js
@@ -36,8 +36,8 @@ window.addEvent('domready', function() {
});
// When Vertical Slide ends its transition, we check for its status
- // note that onComplete will not affect 'hide' and 'show' methods
- myVerticalSlide.addEvent('onComplete', function() {
+ // note that complete will not affect 'hide' and 'show' methods
+ myVerticalSlide.addEvent('complete', function() {
$('vertical_status').set('html', status[myVerticalSlide.open]);
});
@@ -73,8 +73,8 @@ window.addEvent('domready', function() {
});
// When Horizontal Slide ends its transition, we check for its status
- // note that onComplete will not affect 'hide' and 'show' methods
- myHorizontalSlide.addEvent('onComplete', function() {
+ // note that complete will not affect 'hide' and 'show' methods
+ myHorizontalSlide.addEvent('complete', function() {
$('horizontal_status').set('html', status[myHorizontalSlide.open]);
});
});
View
2  Demos/Sortables/index.html
@@ -24,7 +24,7 @@
<p>
The advanced example shows, that it is even possible to drag&amp;drop list-elements
into another list.
- <p/>
+ </p>
<div id="anotherSortablesDemo">
</div>
View
37 Docs/Class/Class.Extras.md
@@ -139,7 +139,7 @@ Class: Events {#Events}
=======================
A Utility Class. Its methods can be implemented with [Class:implement][] into any [Class][].
-In [Fx][], for example, this Class is used to allow any number of functions to be added to the Fx events, like onComplete, onStart, and onCancel.
+In [Fx][], for example, this Class is used to allow any number of functions to be added to the Fx events, like 'complete', 'start', and 'cancel'.
Events in a Class that implements [Events](#Events) must be either added as an option or with addEvent, not directly through .options.onEventName.
### Syntax:
@@ -155,22 +155,26 @@ Events in a Class that implements [Events](#Events) must be either added as an o
### Implementing:
- This class can be implemented into other classes to add its functionality to them.
-- Events has been designed to work well with the [Options](#Options) class when the option property begins with 'on' and is followed by a capital letter (e.g. 'onComplete').
+- Events has been designed to work well with the [Options](#Options) class when the option property begins with 'on' and is followed by a capital letter it will be added as an event (e.g. 'onComplete' will add as 'complete' event).
### Example:
var Widget = new Class({
Implements: Events,
initialize: function(element){
- ...
+ // ...
},
complete: function(){
- this.fireEvent('onComplete');
+ this.fireEvent('complete');
}
});
var myWidget = new Widget();
- myWidget.addEvent('onComplete', myFunction);
+ myWidget.addEvent('complete', myFunction);
+
+### Notes:
+
+- Events starting with 'on' are still supported in all methods and are converted to their representation without 'on' (e.g. 'onComplete' becomes 'complete').
### See Also:
@@ -190,7 +194,7 @@ Adds an event to the Class instance's event stack.
### Arguments:
-1. type - (*string*) The type of event (e.g. 'onComplete').
+1. type - (*string*) The type of event (e.g. 'complete').
2. fn - (*function*) The function to execute.
3. internal - (*boolean*, optional) Sets the function property: internal to true. Internal property is used to prevent removal.
@@ -201,8 +205,7 @@ Adds an event to the Class instance's event stack.
### Example:
var myFx = new Fx.Tween('element', 'opacity');
- myFx.addEvent('onStart', myStartFunction);
-
+ myFx.addEvent('start', myStartFunction);
Events Method: addEvents {#Events:addEvents}
@@ -216,7 +219,7 @@ The same as [addEvent](#addEvent), but accepts an object to add multiple events
### Arguments:
-1. events - (*object*) An object with key/value representing: key the event name (e.g. 'onStart'), and value the function that is called when the Event occurs.
+1. events - (*object*) An object with key/value representing: key the event name (e.g. 'start'), and value the function that is called when the Event occurs.
### Returns:
@@ -226,8 +229,8 @@ The same as [addEvent](#addEvent), but accepts an object to add multiple events
var myFx = new Fx.Tween('element', 'opacity');
myFx.addEvents({
- 'onStart': myStartFunction,
- 'onComplete': function() {
+ 'start': myStartFunction,
+ 'complete': function() {
alert('Done.');
}
});
@@ -245,7 +248,7 @@ Fires all events of the specified type in the Class instance.
### Arguments:
-1. type - (*string*) The type of event (e.g. 'onComplete').
+1. type - (*string*) The type of event (e.g. 'complete').
2. args - (*mixed*, optional) The argument(s) to pass to the function. To pass more than one argument, the arguments must be in an array.
3. delay - (*number*, optional) Delay in miliseconds to wait before executing the event (defaults to 0).
@@ -259,7 +262,7 @@ Fires all events of the specified type in the Class instance.
Implements: Events,
initialize: function(arg1, arg2){
//...
- this.fireEvent("onInitialize", [arg1, arg2], 50);
+ this.fireEvent("initialize", [arg1, arg2], 50);
}
});
@@ -276,7 +279,7 @@ Removes an event from the stack of events of the Class instance.
### Arguments:
-1. type - (*string*) The type of event (e.g. 'onComplete').
+1. type - (*string*) The type of event (e.g. 'complete').
2. fn - (*function*) The function to remove.
### Returns:
@@ -299,7 +302,7 @@ Removes all events of the given type from the stack of events of a Class instanc
### Arguments:
-1. type - (*string*, optional) The type of event to remove (e.g. 'onComplete'). If no type is specified, removes all events of all types.
+1. type - (*string*, optional) The type of event to remove (e.g. 'complete'). If no type is specified, removes all events of all types.
### Returns:
@@ -308,7 +311,7 @@ Removes all events of the given type from the stack of events of a Class instanc
### Example:
var myFx = new Fx.Tween('myElement', 'opacity');
- myFx.removeEvents('onComplete');
+ myFx.removeEvents('complete');
### Notes:
@@ -322,7 +325,7 @@ Class: Options {#Options}
A Utility Class. Its methods can be implemented with [Class:implement][] into any [Class][].
Used to automate the setting of a Class instance's options.
-Will also add Class [Events](#Events) when the option property begins with 'on' and is followed by a capital letter (e.g. 'onComplete').
+Will also add Class [Events](#Events) when the option property begins with 'on' and is followed by a capital letter (e.g. 'onComplete' adds a 'complete' event).
### Syntax:
View
12 Docs/Fx/Fx.md
@@ -39,10 +39,10 @@ Fx Method: constructor {#Fx:constructor}
### Events:
-* onStart - (*function*) The function to execute when the effect begins.
-* onCancel - (*function*) The function to execute when you manually stop the effect.
-* onComplete - (*function*) The function to execute after the effect has processed.
-* onChainComplete - (*function*) The function to execute when using link 'chain' ([see options](#Fx:constructor)). It gets called after all effects in the chain have completed.
+* start - (*function*) The function to execute when the effect begins.
+* cancel - (*function*) The function to execute when you manually stop the effect.
+* complete - (*function*) The function to execute after the effect has processed.
+* chainComplete - (*function*) The function to execute when using link 'chain' ([see options](#Fx:constructor)). It gets called after all effects in the chain have completed.
### Notes:
@@ -58,7 +58,7 @@ Fx Method: constructor {#Fx:constructor}
Fx Method: start {#Fx:start}
----------------------------
-The start method is used to begin a transition. Fires the onStart event.
+The start method is used to begin a transition. Fires the 'start' event.
### Syntax:
@@ -110,7 +110,7 @@ The set method is fired on every step of a transition. It can also be called ma
Fx Method: cancel {#Fx:cancel}
------------------------------
-The cancel method is used to cancel a running transition. Fires the onCancel event.
+The cancel method is used to cancel a running transition. Fires the 'cancel' event.
### Syntax:
View
4 Docs/Plugins/Accordion.md
@@ -40,7 +40,7 @@ The Accordion class creates a group of Elements that are toggled when their hand
## Events:
-### onActive
+### active
* (*function*) Function to execute when an element starts to show.
@@ -53,7 +53,7 @@ The Accordion class creates a group of Elements that are toggled when their hand
1. toggler - (*element*) The toggler for the Element being displayed.
2. element - (*element*) The Element being displayed.
-### onBackground
+### background
* (*function*) Function to execute when an element starts to hide.
View
6 Docs/Plugins/Drag.Move.md
@@ -34,9 +34,9 @@ All the base Drag options, plus:
### Events:
-* onDrop - Executed when the element drops. Passes as argument the element and the element dropped on. If dropped on nothing, the second argument is null.
-* onLeave - Executed when the element leaves one of the droppables.
-* onEnter - Executed when the element enters one of the droppables.
+* drop - Executed when the element drops. Passes as argument the element and the element dropped on. If dropped on nothing, the second argument is null.
+* leave - Executed when the element leaves one of the droppables.
+* enter - Executed when the element enters one of the droppables.
### Example:
View
12 Docs/Plugins/Drag.md
@@ -33,11 +33,11 @@ Drag Method: constructor {#Drag:constructor}
### Events:
-* onBeforeStart - Executed before the Drag instance attaches the events. Receives the dragged element as an argument.
-* onStart - Executed when the user starts to drag (on mousedown). Receives the dragged element as an argument.
-* onSnap - Executed when the user has dragged past the snap option. Receives the dragged element as an argument.
-* onDrag - Executed on every step of the drag. Receives the dragged element as an argument.
-* onComplete - Executed when the user completes the drag. Receives the dragged element as an argument.
+* beforeStart - Executed before the Drag instance attaches the events. Receives the dragged element as an argument.
+* start - Executed when the user starts to drag (on mousedown). Receives the dragged element as an argument.
+* snap - Executed when the user has dragged past the snap option. Receives the dragged element as an argument.
+* drag - Executed on every step of the drag. Receives the dragged element as an argument.
+* complete - Executed when the user completes the drag. Receives the dragged element as an argument.
### Examples:
@@ -125,7 +125,7 @@ Detaches the mouse listener from the handle, preventing the Element from being d
Drag Method: stop {#Drag:stop}
------------------------------
-Stops (removes) all attached events from the Drag instance and executes the onComplete Event.
+Stops (removes) all attached events from the Drag instance and executes the 'complete' Event.
### Syntax:
View
4 Docs/Plugins/Group.md
@@ -22,7 +22,7 @@ Any number of Class instances, or arrays containing class instances.
var xhr3 = new Ajax('template.js', {evalScript: true});
var group = new Group(xhr1, xhr2, xhr3);
- group.addEvent('onComplete', function(){
+ group.addEvent('complete', function(){
alert('All Scripts loaded');
});
@@ -43,7 +43,7 @@ Adds an Event to the stack of Events of the Class instances.
### Arguments:
-1. type - (*string*) The event name (e.g. 'onComplete') to add.
+1. type - (*string*) The event name (e.g. 'complete') to add.
2. fn - (*function*) The callback function to execute when all instances fired this event.
### Returns:
View
2  Docs/Plugins/Scroller.md
@@ -29,7 +29,7 @@ Class: Scroller {#Scroller}
### Events:
-* onChange - (*function*) When the mouse reaches some boundaries, you can choose to alter some other values, instead of the scrolling offsets.
+* change - (*function*) When the mouse reaches some boundaries, you can choose to alter some other values, instead of the scrolling offsets.
#### Signature:
View
10 Docs/Plugins/Slider.md
@@ -32,7 +32,7 @@ Class: Slider {#Slider}
-Slider Event: onChange {#Slider:onChange}
+Slider Event: change {#Slider:change}
-----------------------------------------
* (*function*) Fires when the Slider's value changes.
@@ -47,7 +47,7 @@ Slider Event: onChange {#Slider:onChange}
-Slider Event: onComplete {#Slider:onComplete}
+Slider Event: onComplete {#Slider:complete}
---------------------------------------------
* (*function*) Fire when you're done dragging.
@@ -62,10 +62,10 @@ Slider Event: onComplete {#Slider:onComplete}
-Slider Event: onTick {#Slider:onTick}
+Slider Event: tick {#Slider:tick}
-------------------------------------
-* (*function*) Fires when the user drags the knob. This Event can be overriden to alter the onTick behavior.
+* (*function*) Fires when the user drags the knob. This Event can be overriden to alter the tick behavior.
### Signature:
@@ -77,7 +77,7 @@ Slider Event: onTick {#Slider:onTick}
### Notes:
-- Slider originally uses the onTick event to set the style of the knob to a new position.
+- Slider originally uses the 'tick' event to set the style of the knob to a new position.
### Returns:
View
6 Docs/Plugins/Sortables.md
@@ -21,9 +21,9 @@ Creates an interface for drag and drop sorting of a list or lists.
### Events:
-* onStart - function executed when the item starts dragging
-* onSort - function executed when the item is inserted into a new place in one of the lists
-* onComplete - function executed when the item ends dragging
+* start - function executed when the item starts dragging
+* sort - function executed when the item is inserted into a new place in one of the lists
+* complete - function executed when the item ends dragging
### Examples:
View
16 Docs/Plugins/Tips.md
@@ -25,8 +25,8 @@ Tips Method: constructor {#Tips:constructor}
### Options:
-* showDelay - (*number*: defaults to 100) The delay the onShow method is called.
-* hideDelay - (*number*: defaults to 100) The delay the onHide method is called.
+* showDelay - (*number*: defaults to 100) The delay the show event is fired.
+* hideDelay - (*number*: defaults to 100) The delay the hide hide is fired.
* className - (*string*: defaults to null) the className your tooltip container will get. Useful for extreme styling.
* The tooltip element inside the tooltip container above will have 'tip' as classname.
* The title will have as classname: tip-title
@@ -37,8 +37,8 @@ Tips Method: constructor {#Tips:constructor}
### Events:
- * onHide: fires when the tip is shown
- * onShow: fires when the tip is being hidden
+ * hide: fires when the tip is shown
+ * show: fires when the tip is being hidden
### Example:
@@ -51,7 +51,7 @@ Tips Method: constructor {#Tips:constructor}
var myTips = new Tips('.thisisatooltip');
-Tips Event: onShow {#Tips:onShow}
+Tips Event: show {#Tips:show}
---------------------------------
* (*function*) Fires when the Tip is starting to show and by default sets the tip visible.
@@ -66,11 +66,11 @@ Tips Event: onShow {#Tips:onShow}
### Example:
- myTips.addEvent('onShow', function(tip){
+ myTips.addEvent('show', function(tip){
tip.fade('in');
});
-Tips Event: onHide {#Tips:onHide}
+Tips Event: hide {#Tips:hide}
---------------------------------
* (*function*) Fires when the Tip is starting to hide and by default sets the tip hidden.
@@ -85,7 +85,7 @@ Tips Event: onHide {#Tips:onHide}
### Example:
- myTips.addEvent('onHide', function(tip){
+ myTips.addEvent('hide', function(tip){
tip.fade('out');
});
View
2  Docs/Request/Request.HTML.md
@@ -25,7 +25,7 @@ Request Specifically made for receiving HTML.
### Events:
-#### onComplete
+#### complete
* (*function*) Function to execute when the HTML request completes.
View
12 Docs/Request/Request.md
@@ -29,7 +29,7 @@ An XMLHttpRequest Wrapper.
Request Events: events {#Request:events}
----------------------------------------
-### onRequest
+### request
(*function*) Function to execute when the Request is sent.
@@ -41,7 +41,7 @@ Request Events: events {#Request:events}
1. instance - (Request) The transport instance.
-### onSuccess
+### success
(*function*) Function to execute when the Request completes.
@@ -54,7 +54,7 @@ Request Events: events {#Request:events}
1. responseText - (*string*) The returned text from the request.
2. responseXML - (*mixed*) The response XML from the request.
-### onFailure
+### failure
(*function*) Function to execute when the request fails (error status code).
@@ -66,7 +66,7 @@ Request Events: events {#Request:events}
instance - (Request) The transport instance.
-### onException
+### exception
(*function*) Function to execute when setting a request header fails.
@@ -79,7 +79,7 @@ instance - (Request) The transport instance.
1. headerName - (*string*) The name of the failing header.
2. value - (*string*) The value of the failing header.
-### onCancel
+### cancel
(*function*) Function to execute when a request has been cancelled.
@@ -90,7 +90,7 @@ instance - (Request) The transport instance.
### Properties:
* running - (*boolean*) True if the request is running.
-* response - (*object*) Object with text and XML as keys. You can access this property in the onSuccess event.
+* response - (*object*) Object with text and XML as keys. You can access this property in the 'success' event.
### Returns:
View
2  Docs/Utilities/Swiff.md
@@ -50,7 +50,7 @@ Flash detection and Internet Explorer/Flash Player 9 fix adapted from [SWFObject
myVariableString: 'hello'
},
events: {
- onLoad: myOnloadFunc
+ load: myOnloadFunc
}
});
View
9 Source/Class/Class.Extras.js
@@ -27,6 +27,7 @@ var Chain = new Class({
var Events = new Class({
addEvent: function(type, fn, internal){
+ type = Events.removeOn(type);
if (fn != $empty){
this.$events = this.$events || {};
this.$events[type] = this.$events[type] || [];
@@ -42,6 +43,7 @@ var Events = new Class({
},
fireEvent: function(type, args, delay){
+ type = Events.removeOn(type);
if (!this.$events || !this.$events[type]) return this;
this.$events[type].each(function(fn){
fn.create({'bind': this, 'delay': delay, 'arguments': args})();
@@ -50,6 +52,7 @@ var Events = new Class({
},
removeEvent: function(type, fn){
+ type = Events.removeOn(type);
if (!this.$events || !this.$events[type]) return this;
if (!fn.internal) this.$events[type].erase(fn);
return this;
@@ -66,6 +69,12 @@ var Events = new Class({
});
+Events.removeOn = function(string){
+ return string.replace(/^on([A-Z])/, function(full, first) {
+ return first.toLowerCase();
+ });
+};
+
var Options = new Class({
setOptions: function(){
View
8 Source/Core/Core.js
@@ -93,15 +93,15 @@ Native.alias = function(objects, a1, a2, a3){
};
(function(objects){
- for (var name in objects) Native.typize(objects[name], name.toLowerCase());
-})({'Boolean': Boolean, 'Native': Native, 'Object': Object});
+ for (var name in objects) Native.typize(objects[name], name);
+})({'boolean': Boolean, 'native': Native, 'object': Object});
(function(objects){
for (var name in objects) new Native({name: name, initialize: objects[name], protect: true});
})({'String': String, 'Function': Function, 'Number': Number, 'Array': Array, 'RegExp': RegExp, 'Date': Date});
(function(object, methods){
- for (var i = 0, l = methods.length; i < l; i++) Native.genericize(object, methods[i], true);
+ for (var i = methods.length; i--; i) Native.genericize(object, methods[i], true);
return arguments.callee;
})
(Array, ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice', 'toString', 'valueOf', 'indexOf', 'lastIndexOf'])
@@ -141,7 +141,7 @@ function $extend(original, extended){
};
function $unlink(object){
- var unlinked = null;
+ var unlinked;
switch ($type(object)){
case 'object':
View
8 Source/Fx/Fx.js
@@ -82,16 +82,16 @@ var Fx = new Class({
},
onStart: function(){
- this.fireEvent('onStart', this.subject);
+ this.fireEvent('start', this.subject);
},
onComplete: function(){
- this.fireEvent('onComplete', this.subject);
- if (!this.callChain()) this.fireEvent('onChainComplete', this.subject);
+ this.fireEvent('complete', this.subject);
+ if (!this.callChain()) this.fireEvent('chainComplete', this.subject);
},
onCancel: function(){
- this.fireEvent('onCancel', this.subject).clearChain();
+ this.fireEvent('cancel', this.subject).clearChain();
},
pause: function(){
View
4 Source/Plugins/Accordion.js
@@ -46,7 +46,7 @@ var Accordion = new Class({
for (var i = 0, l = this.togglers.length; i < l; i++) this.addSection(this.togglers[i], this.elements[i]);
this.elements.each(function(el, i){
if (this.options.show === i){
- this.fireEvent('onActive', [this.togglers[i], el]);
+ this.fireEvent('active', [this.togglers[i], el]);
} else {
for (var fx in this.effects) el.setStyle(fx, 0);
}
@@ -91,7 +91,7 @@ var Accordion = new Class({
this.elements.each(function(el, i){
obj[i] = {};
var hide = (i != index) || (this.options.alwaysHide && (el.offsetHeight > 0));
- this.fireEvent(hide ? 'onBackground' : 'onActive', [this.togglers[i], el]);
+ this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]);
for (var fx in this.effects) obj[i][fx] = hide ? 0 : el[this.effects[fx]];
}, this);
return this.start(obj);
View
8 Source/Plugins/Drag.Move.js
@@ -28,7 +28,7 @@ Drag.Move = new Class({
element.setStyle('position', position);
- this.addEvent('onStart', function(){
+ this.addEvent('start', function(){
this.checkDroppables();
}, true);
},
@@ -60,10 +60,10 @@ Drag.Move = new Class({
checkDroppables: function(){
var overed = this.droppables.filter(this.checkAgainst, this).getLast();
if (this.overed != overed){
- if (this.overed) this.fireEvent('onLeave', [this.element, this.overed]);
+ if (this.overed) this.fireEvent('leave', [this.element, this.overed]);
if (overed){
this.overed = overed;
- this.fireEvent('onEnter', [this.element, overed]);
+ this.fireEvent('enter', [this.element, overed]);
} else {
this.overed = null;
}
@@ -77,7 +77,7 @@ Drag.Move = new Class({
stop: function(event){
this.checkDroppables();
- this.fireEvent('onDrop', [this.element, this.overed]);
+ this.fireEvent('drop', [this.element, this.overed]);
this.overed = null;
return this.parent(event);
}
View
10 Source/Plugins/Drag.js
@@ -62,7 +62,7 @@ var Drag = new Class({
start: function(event){
if (this.options.preventDefault) event.preventDefault();
- this.fireEvent('onBeforeStart', this.element);
+ this.fireEvent('beforeStart', this.element);
this.mouse.start = event.page;
var limit = this.options.limit;
this.limit = {'x': [], 'y': []};
@@ -92,7 +92,7 @@ var Drag = new Class({
mousemove: this.bound.drag,
mouseup: this.bound.stop
});
- this.fireEvent('onStart', this.element).fireEvent('onSnap', this.element);
+ this.fireEvent('start', this.element).fireEvent('snap', this.element);
}
},
@@ -114,7 +114,7 @@ var Drag = new Class({
if (this.options.style) this.element.setStyle(this.options.modifiers[z], this.value.now[z] + this.options.unit);
else this.element[this.options.modifiers[z]] = this.value.now[z];
}
- this.fireEvent('onDrag', this.element);
+ this.fireEvent('drag', this.element);
},
cancel: function(event){
@@ -122,7 +122,7 @@ var Drag = new Class({
this.document.removeEvent('mouseup', this.bound.cancel);
if (event){
this.document.removeEvent(this.selection, this.bound.eventStop);
- this.fireEvent('onCancel', this.element);
+ this.fireEvent('cancel', this.element);
}
},
@@ -130,7 +130,7 @@ var Drag = new Class({
this.document.removeEvent(this.selection, this.bound.eventStop);
this.document.removeEvent('mousemove', this.bound.drag);
this.document.removeEvent('mouseup', this.bound.stop);
- if (event) this.fireEvent('onComplete', this.element);
+ if (event) this.fireEvent('complete', this.element);
}
});
View
4 Source/Plugins/Fx.Scroll.js
@@ -25,10 +25,10 @@ Fx.Scroll = new Class({
var stopper = this.element;
if (this.options.wheelStops){
- this.addEvent('onStart', function(){
+ this.addEvent('start', function(){
stopper.addEvent('mousewheel', cancel);
}, true);
- this.addEvent('onComplete', function(){
+ this.addEvent('complete', function(){
stopper.removeEvent('mousewheel', cancel);
}, true);
}
View
2  Source/Plugins/Fx.Slide.js
@@ -15,7 +15,7 @@ Fx.Slide = new Class({
},
initialize: function(element, options){
- this.addEvent('onComplete', function(){
+ this.addEvent('complete', function(){
this.open = (this.wrapper['offset' + this.layout.capitalize()] != 0);
if (this.open && Browser.Engine.webkit419) this.element.dispose().inject(this.wrapper);
}, true);
View
4 Source/Plugins/Scroller.js
@@ -23,10 +23,10 @@ var Scroller = new Class({
this.element = $(element);
this.listener = ($type(this.element) != 'element') ? $(this.element.getDocument().body) : this.element;
this.timer = null;
+ this.coord = this.getCoords.bind(this);
},
start: function(){
- this.coord = this.getCoords.bind(this);
this.listener.addEvent('mousemove', this.coord);
},
@@ -48,7 +48,7 @@ var Scroller = new Class({
else if (this.page[z] + this.options.area > (size[z] + pos[z]) && size[z] + size[z] != scroll[z])
change[z] = (this.page[z] - size[z] + this.options.area - pos[z]) * this.options.velocity;
}
- if (change.y || change.x) this.fireEvent('onChange', [scroll.x + change.x, scroll.y + change.y]);
+ if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);
}
});
View
8 Source/Plugins/Slider.js
@@ -80,7 +80,7 @@ var Slider = new Class({
this.step = Math.round(step);
this.checkStep();
this.end();
- this.fireEvent('onTick', this.toPosition(this.step));
+ this.fireEvent('tick', this.toPosition(this.step));
return this;
},
@@ -92,7 +92,7 @@ var Slider = new Class({
this.step = Math.round(this.min + dir * this.toStep(position));
this.checkStep();
this.end();
- this.fireEvent('onTick', position);
+ this.fireEvent('tick', position);
},
scrolledElement: function(event){
@@ -112,14 +112,14 @@ var Slider = new Class({
checkStep: function(){
if (this.previousChange != this.step){
this.previousChange = this.step;
- this.fireEvent('onChange', this.step);
+ this.fireEvent('change', this.step);
}
},
end: function(){
if (this.previousEnd !== this.step){
this.previousEnd = this.step;
- this.fireEvent('onComplete', this.step + '');
+ this.fireEvent('complete', this.step + '');
}
},
View
2  Source/Plugins/SmoothScroll.js
@@ -21,7 +21,7 @@ var SmoothScroll = new Class({
var anchor = link.href.substr(location.length);
if (anchor && $(anchor)) this.useLink(link, anchor);
}, this);
- if (!Browser.Engine.webkit419) this.addEvent('onComplete', function(){
+ if (!Browser.Engine.webkit419) this.addEvent('complete', function(){
win.location.hash = this.anchor;
}, true);
},
View
6 Source/Plugins/Sortables.js
@@ -107,7 +107,7 @@ var Sortables = new Class({
where = this.element.getAllPrevious().contains(element) ? 'before' : 'after';
}
this.element.inject(element, where);
- this.fireEvent('onSort', [this.element, this.clone]);
+ this.fireEvent('sort', [this.element, this.clone]);
},
start: function(event, element){
@@ -126,7 +126,7 @@ var Sortables = new Class({
event.stop();
this.clone.setStyle('visibility', 'visible');
this.element.set('opacity', this.options.opacity || 0);
- this.fireEvent('onStart', [this.element, this.clone]);
+ this.fireEvent('start', [this.element, this.clone]);
}.bind(this),
onEnter: this.insert.bind(this),
onCancel: this.reset.bind(this),
@@ -159,7 +159,7 @@ var Sortables = new Class({
reset: function(){
this.idle = true;
this.clone.destroy();
- this.fireEvent('onComplete', this.element);
+ this.fireEvent('complete', this.element);
},
serialize: function(){
View
4 Source/Plugins/Tips.js
@@ -118,11 +118,11 @@ var Tips = new Class({
},
show: function(){
- this.fireEvent('onShow', this.tip);
+ this.fireEvent('show', this.tip);
},
hide: function(){
- this.fireEvent('onHide', this.tip);
+ this.fireEvent('hide', this.tip);
}
});
View
10 Source/Request/Request.js
@@ -70,7 +70,7 @@ var Request = new Class({
},
onSuccess: function(){
- this.fireEvent('onComplete', arguments).fireEvent('onSuccess', arguments).callChain();
+ this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain();
},
failure: function(){
@@ -78,7 +78,7 @@ var Request = new Class({
},
onFailure: function(){
- this.fireEvent('onComplete').fireEvent('onFailure', this.xhr);
+ this.fireEvent('complete').fireEvent('failure', this.xhr);
},
setHeader: function(name, value){
@@ -141,10 +141,10 @@ var Request = new Class({
if (!$try(function(){
this.xhr.setRequestHeader(key, value);
return true;
- }.bind(this))) this.fireEvent('onException', [key, value]);
+ }.bind(this))) this.fireEvent('exception', [key, value]);
}, this);
- this.fireEvent('onRequest');
+ this.fireEvent('request');
this.xhr.send(data);
if (!this.options.async) this.onStateChange();
return this;
@@ -156,7 +156,7 @@ var Request = new Class({
this.xhr.abort();
this.xhr.onreadystatechange = $empty;
this.xhr = new Browser.Request();
- this.fireEvent('onCancel');
+ this.fireEvent('cancel');
return this;
}
View
46 Specs/Class/Class.Extras.js
@@ -65,10 +65,10 @@ describe('Events Class', {
'should add an Event to the Class': function(){
var myTest = new Local.EventsTest();
- myTest.addEvent('onEvent', Local.fn);
+ myTest.addEvent('event', Local.fn);
var events = myTest.$events;
- var myEvent = events['onEvent'];
+ var myEvent = events['event'];
value_of(myEvent).should_not_be(undefined);
value_of(myEvent.contains(Local.fn)).should_be_true();
},
@@ -76,26 +76,26 @@ describe('Events Class', {
'should add multiple Events to the Class': function(){
var myTest = new Local.EventsTest();
myTest.addEvents({
- 'onEvent1': Local.fn,
- 'onEvent2': Local.fn
+ 'event1': Local.fn,
+ 'event2': Local.fn
});
var events = myTest.$events;
- var myEvent1 = events['onEvent1'];
+ var myEvent1 = events['event1'];
value_of(myEvent1).should_not_be(undefined);
value_of(myEvent1.contains(Local.fn)).should_be_true();
- var myEvent2 = events['onEvent2'];
+ var myEvent2 = events['event2'];
value_of(myEvent2).should_not_be(undefined);
value_of(myEvent2.contains(Local.fn)).should_be_true();
},
'should add an internal event': function(){
var myTest = new Local.EventsTest();
- myTest.addEvent('onInternal', Local.fn, true);
+ myTest.addEvent('internal', Local.fn, true);
var events = myTest.$events;
- var myEvent = events['onInternal'];
+ var myEvent = events['internal'];
value_of(myEvent).should_not_be(undefined);
value_of(myEvent.contains(Local.fn)).should_be_true();
value_of(myEvent[0].internal).should_be_true();
@@ -104,12 +104,12 @@ describe('Events Class', {
'should remove a specific method for an event': function(){
var myTest = new Local.EventsTest();
var fn = function(){ return true; };
- myTest.addEvent('onEvent', Local.fn);
- myTest.addEvent('onEvent', fn);
- myTest.removeEvent('onEvent', Local.fn);
+ myTest.addEvent('event', Local.fn);
+ myTest.addEvent('event', fn);
+ myTest.removeEvent('event', Local.fn);
var events = myTest.$events;
- var myEvent = events['onEvent'];
+ var myEvent = events['event'];
value_of(myEvent).should_not_be(undefined);
value_of(myEvent.contains(fn)).should_be_true();
},
@@ -117,24 +117,24 @@ describe('Events Class', {
'should remove an event and its methods': function(){
var myTest = new Local.EventsTest();
var fn = function(){ return true; };
- myTest.addEvent('onEvent', Local.fn);
- myTest.addEvent('onEvent', fn);
- myTest.removeEvents('onEvent');
+ myTest.addEvent('event', Local.fn);
+ myTest.addEvent('event', fn);
+ myTest.removeEvents('event');
var events = myTest.$events;
- value_of(events['onEvent'].length).should_be(0);
+ value_of(events['event'].length).should_be(0);
},
'should remove all events': function(){
var myTest = new Local.EventsTest();
var fn = function(){ return true; };
- myTest.addEvent('onEvent1', Local.fn);
- myTest.addEvent('onEvent2', fn);
+ myTest.addEvent('event1', Local.fn);
+ myTest.addEvent('event2', fn);
myTest.removeEvents();
var events = myTest.$events;
- value_of(events['onEvent1'].length).should_be(0);
- value_of(events['onEvent2'].length).should_be(0);
+ value_of(events['event1'].length).should_be(0);
+ value_of(events['event2'].length).should_be(0);
}
});
@@ -186,9 +186,9 @@ describe('Options Class', {
});
var events = myTest.$events;
value_of(events).should_not_be(undefined);
- value_of(events['onEvent1'].length).should_be(1);
- value_of(events['onEvent2'].length).should_be(1);
- value_of(events['onEvent3'].length).should_be(1);
+ value_of(events['event1'].length).should_be(1);
+ value_of(events['event2'].length).should_be(1);
+ value_of(events['event3'].length).should_be(1);
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.