Merge branch 'master' of git@github.com:sstephenson/prototype
This commit is contained in:
commit
b03d4d40a0
@ -1,3 +1,9 @@
|
||||
* Prevent exception when using Selector to search for an attribute that is not present. [gryn, Andrew Dupont]
|
||||
|
||||
* Fix issues where Firefox improperly returns the wrong node from a call to Event.element. Also fixes possible exception in Event.element in IE. [jdalton, Andrew Dupont]
|
||||
|
||||
* Fix issue where Safari 3 deletes custom properties from the document object when the page is returned to via the back button. [mzsanford, kangax, Andrew Dupont]
|
||||
|
||||
* Integrate support for the W3C Selectors API into the Selector class. Will now use the API when possible (browser supports the API *and* recognizes the given selector). Means minor changes to the semantics of :enabled, :disabled, and :empty in order to comply with CSS spec.
|
||||
|
||||
* Avoid re-extending element in Element#getDimensions. [kangax]
|
||||
|
1
dist/.gitignore
vendored
Normal file
1
dist/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
prototype.js
|
29
src/event.js
29
src/event.js
@ -59,8 +59,23 @@ Event.Methods = (function() {
|
||||
isRightClick: function(event) { return isButton(event, 2) },
|
||||
|
||||
element: function(event) {
|
||||
var node = Event.extend(event).target;
|
||||
return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
|
||||
event = Event.extend(event);
|
||||
|
||||
var node = eventTarget, type = event.type;
|
||||
|
||||
if (event.currentTarget) {
|
||||
// Firefox screws up the "click" event when moving between radio buttons
|
||||
// via arrow keys. It also screws up the "load" and "error" events on images,
|
||||
// reporting the document as the target instead of the original image.
|
||||
var currentTarget = event.currentTarget;
|
||||
var tagName = currentTarget.tagName.toUpperCase();
|
||||
if (['load', 'error'].include(type) ||
|
||||
(tagName === 'INPUT' && currentTarget.type === 'radio' && type === 'click'))
|
||||
node = currentTarget;
|
||||
}
|
||||
|
||||
return Element.extend(node && node.nodeType == Node.TEXT_NODE ?
|
||||
node.parentNode : node);
|
||||
},
|
||||
|
||||
findElement: function(event, expression) {
|
||||
@ -188,10 +203,20 @@ Object.extend(Event, (function() {
|
||||
cache[id][eventName] = null;
|
||||
}
|
||||
|
||||
|
||||
// Internet Explorer needs to remove event handlers on page unload
|
||||
// in order to avoid memory leaks.
|
||||
if (window.attachEvent) {
|
||||
window.attachEvent("onunload", destroyCache);
|
||||
}
|
||||
|
||||
// Safari has a dummy event handler on page unload so that it won't
|
||||
// use its bfcache. Safari <= 3.1 has an issue with restoring the "document"
|
||||
// object when page is returned to via the back button using its bfcache.
|
||||
if (Prototype.Browser.WebKit) {
|
||||
window.addEventListener('unload', Prototype.emptyFunction, false);
|
||||
}
|
||||
|
||||
return {
|
||||
observe: function(element, eventName, handler) {
|
||||
element = $(element);
|
||||
|
@ -644,13 +644,14 @@ Object.extend(Selector, {
|
||||
},
|
||||
|
||||
operators: {
|
||||
'=': function(nv, v) { return nv == v; },
|
||||
'!=': function(nv, v) { return nv != v; },
|
||||
'^=': function(nv, v) { return nv.startsWith(v); },
|
||||
'^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); },
|
||||
'$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); },
|
||||
'*=': function(nv, v) { return nv == v || nv && nv.include(v); },
|
||||
'$=': function(nv, v) { return nv.endsWith(v); },
|
||||
'*=': function(nv, v) { return nv.include(v); },
|
||||
'~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
|
||||
'|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
|
||||
'|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() +
|
||||
'-').include('-' + (v || "").toUpperCase() + '-'); }
|
||||
},
|
||||
|
||||
split: function(expression) {
|
||||
|
Loading…
Reference in New Issue
Block a user