Permalink
Browse files

Add native _fireEvent if available.

1st reason:
https://mootools.lighthouseapp.com/projects/2706/tickets/705-no-way-to-access-native-ie-fireevent-method

2nd reason:
Our specs require access to the native fireEvent for emulating user
access actions.
  • Loading branch information...
1 parent d2c86de commit 57749c47f804747a2454be48ff44dbaee0b20de3 @ibolmo ibolmo committed Nov 25, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 Source/Element/Element.js
@@ -41,6 +41,9 @@ var Element = function(tag, props){
return document.newElement(tag, props);
};
+var docFragment = document.createDocumentFragment();
+var FIRE_EVENT = docFragment.createElement && docFragment.createElement('div').fireEvent;
+
if (Browser.Element) Element.prototype = Browser.Element.prototype;
new Type('Element', Element).mirror(function(name){
@@ -250,6 +253,9 @@ Document.implement({
if (!nocash && !el.$family && !(/^(?:object|embed)$/i).test(el.tagName)){
Object.append(el, Element.Prototype);
}
+ if (FIRE_EVENT && !el._fireEvent) el._fireEvent = function(){
+ return FIRE_EVENT.apply(el, arguments);
+ };
return el;
},

0 comments on commit 57749c4

Please sign in to comment.