Closed Bug 21797 Opened 25 years ago Closed 25 years ago

Javascript errors on this page related to hiding and showing text via Javascript and DOM ...

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Windows 98
defect

Tracking

()

VERIFIED INVALID

People

(Reporter: chrisn, Assigned: vidur)

References

()

Details

If you visit this URL: http://206.9.170.23/w3CDomtest.html and click on the three "Click me" links at the top of the page, I get these errors in the console (Build 12-14-99, P2-400, 128M): First link clicked (any of the three) gives me this error: JavaScript Error: TypeError: [xxxxxxxxxxxxxxxx] has no properties where [xxxxxxxxxxx] is the node type the particular link sends via the function call. After that, if you click any of the three links, you get these errors: JavaScript Error: access disallowed from scripts at [Codebase javascript: HideShowText(document.childNodes[1].childNodes[1].childNodes[0])] to documents a t another domain JavaScript Error: uncaught exception: [Exception... "Security error" code: "100 0" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: "<unknown>"] The three links access this function: function HideShowText(obj) { if (obj.style.display=="none") { obj.style.display=""; } else { obj.style.display="none"; } } The first link calls the function with these parameters: HideShowText(document.childNodes[1].childNodes[1].childNodes[0]) The second calls it with these: HideShowText(document.childNodes[0].nextSibling.childNodes[1].childNodes[0]) And the third with these: HideShowText(document.childNodes[1].childNodes[1].childNodes[1]) Is there something wrong with the syntax on this page? Also, could this be a dupe of bug 17003? This bug was part of bug 21762, but I decided to break it out into its own report.
The problem's with the page itself. I don't see the security exceptions anymore, but the parameters to the method HideShowText() are incorrect. document.childNodes[0] is the HTML element. It has no siblings, so both document.childNodes[1] and document.childNodes[0].nextSibling don't exist. Ah wait, I see the DOCTYPE declaration at the top. As per the DOM spec, we don't represent the DOCTYPE decl in the structure of the document. I'd suggest using document.documentElement or document.body for more robust test cases.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
Mass update of qa contact
QA Contact: gerardok → janc
verified 2000-09-15-08-M18
Status: RESOLVED → VERIFIED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.