JavaScript incorrect behaviour with OBJECT tag

RESOLVED DUPLICATE of bug 250012

Status

Toolkit Graveyard
Error Console
--
critical
RESOLVED DUPLICATE of bug 250012
14 years ago
2 years ago

People

(Reporter: Vlad Alexander, Assigned: Ben Goodger (use ben at mozilla dot org for email))

Tracking

Details

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1

There seems to be no way using JavaScript to determine if the browser is using
the OBJECT tag or alternate content. For example, using this construct, if the
browser does not find the object clsid, a textarea is rendered:

<object classid="clsid:abc..." id="object1" width="100%" height="400">
     <textarea name="alternate1" id="alternate1" cols="60" rows="15"></textarea>
</object>

However, in Mozilla/FireFox, it is impossible to determine this
programmatically. In IE, the following script works but fails in Mozilla/FireFox.

if (document.getElementById('object1') && document.getElementById('object1') !=
null) {
     alert('object is rendered');
} else {
     alert('textarea is rendered');
}


Reproducible: Always
Steps to Reproduce:
1. create an <object> tag with an invalid clsid
2. use JavaScript to test the existence of this <object>. For example:
alert(document.getElementById('object1'));


Actual Results:  
JavaScript returns an instance of the object even if the object is not rendered.

Expected Results:  
JavaScript should return "null".

Comment 1

14 years ago

*** This bug has been marked as a duplicate of 250012 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → DUPLICATE
Product: Firefox → Toolkit
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.