Closed Bug 306484 Opened 19 years ago Closed 19 years ago

addEventListener thows an unhandled error exception

Categories

(Firefox :: General, defect)

x86
Windows 2000
defect
Not set
major

Tracking

()

RESOLVED INVALID

People

(Reporter: normallison, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6

whenever the browser encouters a call to obj.addEventListener(... an exception
is thrown by the built in function. The javascrip console says 'Error: uncaught
exception: null'

The example code from the Mozzilla online manual fails in exactly the same way!

Reproducible: Always

Steps to Reproduce:
1. run the encluded page
2. check the javascript console
3.

Actual Results:  
the page fails and all javascript porcessing halts

Expected Results:  
It should have worked exactly as the Mozzilla online manual, and the w3c
definitions say that it should. 

this simple page will cause the problem every time:

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> Test addEvenListener in FireFox 1.6</title>
</head>
<script type="text/javascript">
function showClick (e)
{
  alert(e.type);
}
function init()
{
  var vObj = document.getElementById('testField');
  vObj.addEventListener('click', 'showClick', false);
}
</script>
<body onload='init();'>
<input type='text' id='testField' value='test' /'>
</body>
</html>
The script seems to work when I remove the quotes around showClick in
vObj.addEventListener('click', 'showClick', false);.
Do you have a link to the "example code from the Mozzilla online manual" that fails?
This one turns out to be my mistake. It seems the problem is with the quotes 
around the function. It seems I didn't clear the 'javascript console' window 
before testing the example from the manual.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.