Closed Bug 250013 Opened 20 years ago Closed 20 years ago

JavaScript incorrect behaviour with OBJECT tag

Categories

(Toolkit Graveyard :: Error Console, defect)

x86
Windows XP
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 250012

People

(Reporter: vlad.alexander, Assigned: bugs)

Details

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".

*** This bug has been marked as a duplicate of 250012 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 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.