Fix isEventSupported in recent versions of jsdom.
Setting the `eventName` attribute of an element to the empty string is not enough to cause `typeof element[eventName] === 'function'` in jsdom. The attribute value actually has to look like a function body.
Ben Newman committed
Oct 1, 2013 at 15:46 UTC
7c0f5c3237ddf0f3cbc12382bbe59b177075659a
1 file changed
+1
-1
src/dom/isEventSupported.js
+1
-1
@@ -54,7 +54,7 @@ function isEventSupported(eventNameSuffix, capture) {
54
var isSupported = eventName in element;
55
56
if (!isSupported) {
57
- element.setAttribute(eventName, '');
57
+ element.setAttribute(eventName, 'return;');
58
isSupported = typeof element[eventName] === 'function';
59
if (typeof element[eventName] !== 'undefined') {
60
element[eventName] = undefined;