On Mar 3, 10:18Â*pm, KĹ™ištof Ĺ˝elechovski <giecr...@stegny.2a.plwrote:
At <http://jibbering.com/faq/index.html#FAQ4_41>
SHOULD BE
Microsoft introduced a shortcut that can be used to reference
elements THAT ARE NOT FORM CONTROLS WITHIN A FORM ELEMENT
which include an ID attribute
That is not true for Firefox 1.5 in quirk mode (no appropriate DOCTYPE
switcher). IDed form controls are affected as well by this extension.
A regular payback for trying to monkey out undocumented 3rd party
quirks - high risk to get it either wrong or "too right".
IMHO i) either we leave it as it is as it is better to overcover than
undercover or ii) we are making a quirks table for all browsers up-to-
date emulated the behavior in question.
Which one is the best I don't know. What do you think?
where the ID becomes A PROPERTY OF THE GLOBAL WINDOW OBJECT and the
scope of the window object is at the bottom of the symbol lookup
stack..
There is not such thing as "global window object". There is Global
object representing the current script execution context and there is
window host object which is normally presented and - if presented -
placed before the Global. This way by crafting window properties one
can "shadow" global variables in Global scope, but it is not the best
way. It is better to pre-declare - if possible - all global variables
used in the script by using var statement. This kill the unwanted id -
var echoing.
P.S. For window host object and Global object differences read MSDN
and older topics in this group. For practical demonstration on IE it
requires to create parallel Global scope using behavior. Firefox is
much easier on this matter, something like:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script>
function init() {
alert(typeof txt);
window.txt = true;
alert(typeof txt);
delete(window.txt);
alert(typeof txt);
}
window.onload = init;
</script>
</head>
<body>
<form method="post" action="">
<input type="text" name="txt" id="txt">
</form>
</body>
</html>