Closed
Bug 387560
Opened 18 years ago
Closed 15 years ago
Unsuspected behavour using the call() method on removeEventListener and dispatchEvent()
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: hejsa1234, Unassigned)
Details
(Keywords: testcase)
Attachments
(1 file)
414 bytes,
text/html
|
Details |
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
When invoking the call() method on either removeEventListener or dispatchEvent() the error log shows:
Error: uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame :: URL_GOES_HERE :: init :: line 17" data: no]
As addEventListener.call(someElement, type, handler, useCapture) works as intended I percieve the above as an error...I might be wrong of course
Reproducible: Always
Steps to Reproduce:
<html>
<head>
<script type="text/javascript">
function test() {
alert('Hello');
}
function init() {
document.addEventListener.call(document.getElementById('aDiv'),"mousedown",test,true);
document.removeEventListener(document.getElementById('aDiv'),"mousedown",test,true);
}
</script>
</head>
<body onload="init();">
<div id="aDiv">A div</div>
</body>
</html>
Actual Results:
Produces the above mentioned error.
Expected Results:
I would expect the call to remove the event handler test() from the element with id "aDiv"
Forgot the test code for dispatchEvent.call()...sorry. Put this in between the script tags:
var e = document.createEvent("MouseEvent");
e.initMouseEvent("mousedown", true, true, window,0, 0, 0, 0, 0, false, false, false, false, 0, null);
document.dispatchEvent.call(document.getElementById('div1'),e);
Updated•18 years ago
|
Assignee: general → nobody
Component: General → DOM
Keywords: testcase
Product: Mozilla Application Suite → Core
QA Contact: general → general
Version: unspecified → 1.8 Branch
Updated•18 years ago
|
QA Contact: general → events
Comment 3•17 years ago
|
||
Confirmed with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b2pre) Gecko/2007111104 Minefield/3.0b2pre
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: 1.8 Branch → Trunk
Comment 4•15 years ago
|
||
Works now for me - the test case loads without errors and clicking the div doesn't alert. Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100105 Firefox/3.6
Please reopen if I'm wrong.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•