Reorganize the way `ElementExtensions` are defined. Make sure elements used in SpecificElementExtensions are cleaned up.
This commit is contained in:
parent
fa4314aeea
commit
7d02aef6ca
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
})()
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue