Permalink
Browse files

Small fixes to NativeEvent docs.

  • Loading branch information...
1 parent ba51b8a commit bb22a2061406d3e5410717ae002aa9f7a0c2882f @ibolmo ibolmo committed Dec 19, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 Docs/Element/Element.Event.md
@@ -337,22 +337,22 @@ By default it is undefined. In this case you can add events, but you should manu
element.addEvent('pizza', fn);
element.fireEvent('pizza', 'yum!');
-
+
The event is not actually added to the DOM, but is only registered in a JS object.
### Type 1 Events
-The second case is if the value is 1. This time the object is attached to the DOM. Usually by element.addEventListener, or element.attacheEvent in older versions of IE. You can still use `element.fireEvent('load')` to manually fire events.
+The second case is if the value is 1. This time the object is attached to the DOM. Usually by element.addEventListener, or element.attachEvent in older versions of IE. You can still use `element.fireEvent('load')` to manually fire events.
### Type 2 Events
The final case is if the value is 2. This is the same as case 1. The only difference is that the event object, containing interesting data, is wrapped and normalized by event wrapper ([DOMEvent][]). This is the most used variant, for mouse events (like *click*) and keyboard events.
-The reason to differentiate between 1 and 2 is that 1 is usually used for events that don't have interesting data, like onload, onscroll, onresize. Those last two fire an awful lot as well.
+The reason to differentiate between 1 and 2 is that 1 is usually used for events that don't have interesting data like: `onload`, `onscroll`, and `onresize`, or it's more performant. The latter two, for example, are fired frequently.
### Adding unsupported events
-As browsers evolve, new event types appear that you want to use, or browser specific events that are not supported by MooTools because they are only useful in specific cases. If you want to use those through the MooTools API there is a problem. The problem is that the event type has to be registered in the object, otherwise it will handle the event as case 0. This can be done with, for example:
+Not all events are supported by MooTools' Element Events API because of edge use cases or new events supported by the browser. To add support for a native event, just augment the `Element.NativeEvents` object with the key and **appropriate** key value (use the above). For example to add `popstate` support in your application:
Element.NativeEvents.popstate = 2;
// Now element.addEvent('popstate', fn); will work everywhere

0 comments on commit bb22a20

Please sign in to comment.