Closed Bug 270791 Opened 20 years ago Closed 20 years ago

document.getElementById(form_id) does not work when before happens a 'style has no properties' error due to DOMobject.style.xxx

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: viniciuscb, Assigned: bugzilla)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

An 'style has no properties' error appeared, due to an object.style.width = x,
and then after this error I could not get a 'form' object by
document.getElementById().

I think that document.getElementById() could stay working, even when some minor
javascript errors happens.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Hi

Please could you attach a testcase that demonstrates this problem. I tried to
create one, but was unsuccessful. This will make understanding the bug allot easier.
Summary: document.getElementById(form_id) does not work when before happens a 'style has no properties' error due to DOMobject.style.xxx → document.getElementById(form_id) does not work when before happens a 'style has no properties' error due to DOMobject.style.xxx
Vinicius, a testcase or a clearer description of the problem is needed for this
bug to go anywhere.
Error reproduced with attmepting to logout of http://www.aria.co.uk/.

Javascript console returns: 
Error: document.getElementById("logoutForm") has no properties
Source File: javascript:document.getElementById('logoutForm').submit();
Line: 1

O/S - Windows 2000 SP4(Build2195)
Browser -  Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5)
Gecko/20041107 Firefox/1.0
Attached file testcase for this bug
this attachment explains better and demonstrates this bug.
In your testcase, everything is working as expected for me. The first button
always works, regardless of any previous errors.

Can you be clearer on the expected/actual results? Are you saying that after
clicking the second button, the alert does not appear when clicking the first
button?
No. I say that the remaining code in the second button is not executed after the
style error.
So basically this bug is about that Javascript stops executing the rest of the
code, after it ran into an error.
Yes that's it.
This is invalid. All other browsers behave exactly the same way. If there is an
error in the code, then execution is stopped as it should be. If you absolutely
don't want to stop execution, wrap the code that causes an error in a try block
like this:

var obj = new Object();
try { obj.style.width = '600'; } catch (e) {}

See bug 95463 comment 0 for a similar situation that was also invalidated.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: