Prototype: Fix event extensions and custom events firing for Safari 2.0
This commit is contained in:
parent
30aa7a6532
commit
cbaec757e2
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Fix event extensions and custom events firing for Safari 2.0. [Thomas Fuchs]
|
||||
|
||||
* Add RegExp.escape for escaping regular expression strings. Closes #9094. [Ken Snyder]
|
||||
|
||||
* Make the eventName and handler arguments to Event.stopObserving optional. If no handler is specified, all handlers for the given event are unregistered. If no event name is specified, all observed events on the element are unregistered. [sam]
|
||||
|
|
15
src/event.js
15
src/event.js
|
@ -99,7 +99,14 @@ Event.extend = (function() {
|
|||
};
|
||||
|
||||
} else {
|
||||
Event.prototype = Event.prototype || document.createEvent("Events").__proto__;
|
||||
if(!Event.prototype) try {
|
||||
Event.prototype = document.createEvent("Events").__proto__;
|
||||
} catch(e) {
|
||||
return function(event) {
|
||||
if (event._extendedByPrototype) return event;
|
||||
return Object.extend(event, methods);
|
||||
};
|
||||
}
|
||||
Object.extend(Event.prototype, methods);
|
||||
return Prototype.K;
|
||||
}
|
||||
|
@ -212,7 +219,11 @@ Object.extend(Event, (function() {
|
|||
element = document.documentElement;
|
||||
|
||||
if (document.createEvent) {
|
||||
var event = document.createEvent("Events");
|
||||
try {
|
||||
var event = document.createEvent("Events");
|
||||
} catch(e) {
|
||||
var event = document.createEvent("UIEvents");
|
||||
}
|
||||
event.initEvent("dataavailable", true, true);
|
||||
} else {
|
||||
var event = document.createEventObject();
|
||||
|
|
Loading…
Reference in New Issue