From 4af7dc0f5dfab70a87550d1e3d996328467fac41 Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Wed, 21 Jan 2009 20:29:23 -0600 Subject: [PATCH] Changed feature detection in order to properly detect the mutable Element prototypes in IE8. --- src/prototype.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/prototype.js b/src/prototype.js index e5a760f..fb85404 100644 --- a/src/prototype.js +++ b/src/prototype.js @@ -16,11 +16,25 @@ var Prototype = { BrowserFeatures: { XPath: !!document.evaluate, SelectorsAPI: !!document.querySelector, - ElementExtensions: !!window.HTMLElement, - SpecificElementExtensions: - document.createElement('div')['__proto__'] && - document.createElement('div')['__proto__'] !== - document.createElement('form')['__proto__'] + ElementExtensions: (function() { + if (window.HTMLElement && window.HTMLElement.prototype) + return true; + if (window.Element && window.Element.prototype) + return true; + })(), + 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; + } + + return false; + })() }, ScriptFragment: ']*>([\\S\\s]*?)<\/script>',