WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
10686
event instanceof MouseEvent throws exception
https://bugs.webkit.org/show_bug.cgi?id=10686
Summary
event instanceof MouseEvent throws exception
Eric Seidel (no email)
Reported
2006-09-01 22:44:50 PDT
myDiv instanceof Element returns false! Firefox (correctly) returns true.
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Operators:Special_Operators:instanceof_Operator
Attachments
A few different instanceof tests
(1.33 KB, application/xhtml+xml)
2006-12-09 07:40 PST
,
C Snover
no flags
Details
Correct testcase.
(1.37 KB, application/xhtml+xml)
2006-12-09 07:45 PST
,
C Snover
no flags
Details
patch
(15.30 KB, patch)
2007-12-30 14:12 PST
,
Sam Weinig
oliver
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
C Snover
Comment 1
2006-12-09 07:40:34 PST
Created
attachment 11787
[details]
A few different instanceof tests instanceof is a bit more broken than just Element. I've attached a very simple testcase for instanceof. All six tests should return TRUE, but only the Object test returns TRUE; the others either return FALSE or error.
C Snover
Comment 2
2006-12-09 07:41:45 PST
Comment on
attachment 11787
[details]
A few different instanceof tests <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
"> <html xmlns="
http://www.w3.org/1999/xhtml
"> <head> <title>instanceof test</title> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/> </head> <script type="text/javascript"> // <![CDATA[ window.addEventListener('load', function() { document.getElementById('clickme').addEventListener('click', function(evt) { try { alert("Object: " + (evt instanceof Object)); } catch(e) { errstr(e); } try { alert("Event: " + (evt instanceof Event)); } catch(e) { errstr(e); } try { alert("MouseEvent: " + (evt instanceof MouseEvent)); } catch(e) { errstr(e); } try { alert("Element: " + (evt.target instanceof Element)); } catch(e) { errstr(e); } try { alert("HTMLElement: " + (evt.target instanceof HTMLElement)); } catch(e) { errstr(e); } try { alert("HTMLDivElement: " + (evt.target instanceof HTMLDivElement)); } catch(e) { errstr(e); } }, false); }, false); function errstr(e) { var errstr = ""; for(var i in e) { errstr += i + " = " + e[i] + "\n"; } alert(errstr); }; // ]]> </script> <body> <div id="clickme">Click here to test instanceof Object, Event, MouseEvent, Element, HTMLElement, and HTMLDivElement (one alert per test)</div> </body> </html>
C Snover
Comment 3
2006-12-09 07:45:13 PST
Created
attachment 11788
[details]
Correct testcase. Whoops. That button did not do what I thought it was going to do. Sorry about the spam.
Geoffrey Garen
Comment 4
2006-12-11 23:49:14 PST
This is because the global constructors don't have .prototype properties.
David Kilzer (:ddkilzer)
Comment 5
2007-03-06 18:52:16 PST
See also
Bug 12686 Comment #6
.
Kevin McCullough
Comment 6
2007-03-07 14:17:47 PST
fixed in
r19993
. However we still get an error for instanceof MouseEvent because MouseEvent is not a constructor.
David Kilzer (:ddkilzer)
Comment 7
2007-12-30 09:39:01 PST
(In reply to
comment #6
)
> fixed in
r19993
. However we still get an error for instanceof MouseEvent > because MouseEvent is not a constructor.
Same issue still occurs with
r29032
.
Sam Weinig
Comment 8
2007-12-30 14:12:08 PST
Created
attachment 18197
[details]
patch
Sam Weinig
Comment 9
2007-12-30 14:26:34 PST
Fix landed in
r29041
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug