Reorganize the way ElementExtensions are defined. Make sure elements used in SpecificElementExtensions are cleaned up.

This commit is contained in:
Juriy Zaytsev 2009-05-30 02:04:32 -04:00 committed by Andrew Dupont
parent fa4314aeea
commit 7d02aef6ca
2 changed files with 13 additions and 9 deletions

View File

@ -1,3 +1,5 @@
* Reorganize the way `ElementExtensions` are defined. Make sure elements used in SpecificElementExtensions are cleaned up. (kangax)
* Make sure $A works with primitive values. (mr_justin, kangax)
* Do not browser sniff when forking `unmark` function in selector suite. Instead use a proper test - PROPERTIES_ATTRIBUTES_MAP. (kangax)

20
src/prototype.js vendored
View File

@ -27,23 +27,25 @@ var Prototype = {
XPath: !!document.evaluate,
SelectorsAPI: !!document.querySelector,
ElementExtensions: (function() {
if (window.HTMLElement && window.HTMLElement.prototype)
return true;
if (window.Element && window.Element.prototype)
return true;
var constructor = window.Element || window.HTMLElement;
return !!(constructor && constructor.prototype);
})(),
SpecificElementExtensions: (function() {
SpecificElementExtensions: (function() {
// First, try the named class
if (typeof window.HTMLDivElement !== 'undefined')
return true;
var div = document.createElement('div');
if (div['__proto__'] && div['__proto__'] !==
document.createElement('form')['__proto__']) {
return true;
var form = document.createElement('form');
var isSupported = false;
if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) {
isSupported = true;
}
return false;
div = form = null;
return isSupported;
})()
},