Firefox 4 beta won't allow dynamic creation of elements (Javascript) in new window?

908 views Asked by At

It seems I can't really append elements to a new window in Firefox 4 beta (tested with beta 10). It works fine in Firefox 3, Opera, Chrome and IE6, but it seems FF beta 4 broke it.

Here's a simple demonstration HTML page

<html>
<head>
<script type="text/javascript">
function c() {
    var o = window.open("", "", "status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1,width=400,height=400");

    if(!o.document.body) {
        var b = o.document.createElement("body");
        o.document.body = o.document.appendChild(b);
    }
    var e = o.document.createElement("div");
    o.document.body.appendChild(e);
    e.innerHTML="abc";
}
</script>
</head>
<body>
<a href="javascript:c();">abc</a>
</body>
</html>

Basically, it's a page with a link, when clicked, pops up a new window with the text "abc" in it. In Firefox beta 4, it pops up with the window, but nothing is displayed in it. Using Firebug, it appears the nodes are created, but everything under the tag, (including the tag itself) is faded out in the tree, similar to invisible elements. However, the computed CSS show that display and visibility styles are fine.

Does anyone have any idea on how to make it work in Firefox beta 4?

1

There are 1 answers

0
anon On BEST ANSWER

According to this bug report, a fix should have been pushed to the repository, some days after the release of 4.0. This means that this behavior is expected to be fixed in next version of Firefox.