Re: ACTION-61: text for embedding part of the Window object

Another question on window.name.  Consider the following HTML:

<html>
<head><script>
function doit() {
   document.getElementById("x").setAttribute("name", "y");
   alert(window.frames[0].name);
}
</script></head>
<body onload="doit()">
<iframe name="x" id="x">
</iframe>
</html>

When I load this, I get:

   Gecko: 'x'
   khtml: 'x'
   Opera: 'y'

If I modify my onload handler as follows:

function doit() {
   var node = document.getElementById("x");
   node.setAttribute("name", "y");
   node.parentNode.removeChild(node);
   document.body.appendChild(node);
   alert(window.frames[0].name);
}

Then I get:

   Gecko: 'y'
   khtml: 'x'
   Opera: undefined

Oh, and in future versions of Gecko I may well end up getting 'x' as well, 
unless we take special pains to implement a different behavior.

I don't know what IE does on these testcases, but it'd be interesting to find out.

Not sure what, if anything, can be specced here, but....

-Boris

Received on Monday, 6 March 2006 16:50:01 UTC