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)
Tracking
()
RESOLVED
INVALID
People
(Reporter: viniciuscb, Assigned: bugzilla)
Details
Attachments
(1 file)
|
840 bytes,
text/html
|
Details |
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.
Comment 1•20 years ago
|
||
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
Comment 2•20 years ago
|
||
Vinicius, a testcase or a clearer description of the problem is needed for this bug to go anywhere.
Comment 3•20 years ago
|
||
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
| Reporter | ||
Comment 4•20 years ago
|
||
this attachment explains better and demonstrates this bug.
Comment 5•20 years ago
|
||
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?
| Reporter | ||
Comment 6•20 years ago
|
||
No. I say that the remaining code in the second button is not executed after the style error.
Comment 7•20 years ago
|
||
So basically this bug is about that Javascript stops executing the rest of the code, after it ran into an error.
| Reporter | ||
Comment 8•20 years ago
|
||
Yes that's it.
Comment 9•20 years ago
|
||
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.
You need to log in
before you can comment on or make changes to this bug.
Description
•