This issue is related to whether an XHTML document exposes an HTML DOM or an XML DOM. Currently, the XML DOM is exposed so "document.onclick" is not supposed to work in XHTML. See bug 7833 for more discussion on this topic. CCing Vidur for an update on what the DOM working group thinks about this. Setting target milestone to M16...
Moving bugs out by one milestone...
Target Milestone: M16 → M17
On re-reading this bug, I feel that your test case is an XML document and will , therefore, never expose the HTML Document DOM. So, document.onclick is never going to work for the case you described. I think the real question to ask here is the following. Do the DOM 2 event apis specify a way for scripts to listen to events inside XML documents. If they do, what is the status of their implementation in Mozilla? Re-assigning this bug to joki because he's the events god.
Assignee: nisheeth → joki
Status: ASSIGNED → NEW
Tom, if you save the attached test.xml and test.js in the same directory and load test.xml, you'll see a JS alert. This means that the test.js file is getting loaded and executed properly.
Okay, funky. So the problem isn't with the event listeners. The problem is with the script running. After the first alert dialog box runs the script stops. I haven't looked into why yet. I was going to recommend replacing the document.onclick = document_onClick; with document.addEventListener("click", document_onClick, false); per the DOM Level 2 spec but it actually seems that these both work, the problem is the alert box. If you try putting two alert boxes in a row here you'll see that only one gets called. Weird. Well I'm going to bounce this back to you nisheeth for the script analysis.
Assignee: joki → nisheeth
The test case works fine. The document.onclick syntax is invalid inside an XML document because only the DOM Core interfaces are useable inside an XML document. Marking bug invalid.
Status: NEW → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → INVALID
Adding 'verifyme' keyword
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.