Bug 253091 and compatibility to MSIE 6's DOM node scope (chain scope lookup)

This file is still in development. Last update:

Contents

Reminder:
Orange border = form element

Maroon border = div element

This orange bordered element is a form element

input type="text" name="foo" onmouseover="foo.value = InputCounter++;": (case 1)

The form has an onsubmit event attribute set to: "foo.value = InputCounter++;" (Case 2)

(Case 3)This maroon bordered div has an onclick event handler set to "foo.value = InputCounter++;" : foo.value = InputCounter++;
(Case 4)This maroon bordered div has an onclick event handler set to: foo.value = InputCounter++;
(Case 5)This maroon bordered div has an onclick event handler set to: foo.value = InputCounter++;

(Case 6) <form name="FormName" action="">

<input type="text" name="InputTextName" value="2">

<input type="button" value="Multiply by 2" onclick="MultiplyByTwo();">

In the <head> section: function MultiplyByTwo() {FormName.InputTextName.value *= 2;}

(Case 7) <input type="button" name="asdf" value="Call the asdf() function" onclick="asdf();">

In the <head> section: function asdf() {alert("SUCCESS! You just pressed the \"Call the asdf()\" button which triggered the asdf() function defined in the <head> section.");}

Explanation: MSIE 6 makes named elements as properties of the global object, as global variables. So, the global variable "asdf", which was initially pointing to the asdf() function, gets overwritten with a reference to the input element.

(Case 8) <input type="button" name="lkjh" value="Call the asdf() function" onclick="asdf();">

In the <head> section: function asdf() {alert("SUCCESS! You just pressed the \"Call the asdf()\" button which triggered the asdf() function defined in the <head> section.");}

Same code as Case 7 except I renamed the input from asdf to lkjh. Notice that now the asdf() function is called and the code works without a itch.

(Case 9)<input type="submit" name="submit">

<input type="button" value="Submit this form" onclick="submit();">

(Case 10) <input type="submit" name="qwert">

<input type="button" value="Submit this form" onclick="submit();">

Summary of results gathered on event handlers trying to assign foo.value
CasesMSIE 6Mozilla 1.8a3 build 2004082007
<input type="text" name="foo" onmouseover="foo.value = InputCounter++;">
To test this: (Case 1) hover your mouse over the red bordered input with black background
Succeeds with no javascript console error reportedSucceeds with no javascript console error reported
<form ... onsubmit="foo.value = InputCounter++;"> with <input name="foo" ...> defined within that <form> element
To test this: (Case 2) click on the Submit Query button
Succeeds with no javascript console error reportedSucceeds with no javascript console error reported
foo.value = InputCounter++;
when <input name="foo" ...> and calling event handler are within the same <form> element
To test this: (Case 3) click anywhere inside the maroon bordered div
Succeeds with no javascript console error reportedFails with a javascript console error reported saying
foo is not defined
foo.value = InputCounter++;
when <input name="foo" ...> is within <form> element and calling event handler is OUTside that <form> element
To test this: (Case 4) click inside the maroon bordered div or (Case 5) inside the maroon bordered div
Fails with a javascript console error reported saying
'foo' is undefined
Fails with a javascript console error reported saying
foo is not defined
CasesMSIE 6Mozilla 1.8a3 build 2004082007
FormName.InputTextName.value *= 2;
when <form name="FormName" ...> [...]
<input type="text" name="InputTextName" value="2"> [...]
<input type="button" value="Multiply by 2" onclick="MultiplyByTwo();"> [...]
In the <head> section:
function MultiplyByTwo() {FormName.InputTextName.value *= 2;}
To test this: (Case 6): click the "Multiply by 2" button
Succeeds with no javascript console error reportedFails with a javascript console error reported saying
FormName is not defined
<input type="button" name="asdf" value="Call the asdf() function" onclick="asdf();">
In the <head> section: function asdf() {alert("You just pressed the asdf button which triggered the asdf() function defined in the <head> section.");}
To test this: (Case 7): click the "Call the asdf() function" button
Fails with a javascript console error reported saying
Object does not support this property or method
Fails with a javascript console error reported saying
asdf is not a function
<input type="button" name="lkjh" value="Call the asdf() function" onclick="asdf();">
In the <head> section: function asdf() {alert("You just pressed the asdf button which triggered the asdf() function defined in the <head> section.");}
To test this: (Case 8): click the "Call the asdf() function" button
Succeeds with no javascript console error reportedSucceeds with no javascript console error reported
CasesMSIE 6Mozilla 1.8a3 build 2004082007
<input type="submit" name="submit">
<input type="button" value="Submit this form" onclick="submit();">
To test this: (Case 9): click the "Submit this form" button
Fails with a javascript console error reported saying
Object doesn't not support this property or method
Fails with a javascript console error reported saying
submit is not a function
<input type="submit" name="qwert">
<input type="button" value="Submit this form" onclick="submit();">
To test this: (Case 10): click the "Submit this form" button
Succeeds with no javascript console error reportedSucceeds with no javascript console error reported
CasesMSIE 6Mozilla 1.8a3 build 2004082007

<a name="AnchorName">

filling

filling

filling

<a id="AnchorId">

filling

filling

filling

<a id="AnchorSameIdAndName">

filling

filling

filling

<a name="AnchorSameIdAndName">

filling

filling

filling

<a href="#AnchorId">

filling

filling

filling

<a href="#AnchorName">

filling

filling

filling

<a href="#AnchorSameIdAndName">

Valid HTML 4.01! Valid CSS!