Closed
Bug 156206
Opened 22 years ago
Closed 22 years ago
{ib}Unable to set "display" style prop. from JS code
Categories
(Core :: Layout, defect, P4)
Core
Layout
Tracking
()
RESOLVED
DUPLICATE
of bug 171830
Future
People
(Reporter: ptashek, Assigned: attinasi)
References
Details
Attachments
(3 files, 1 obsolete file)
I have code like this in HTML:
<input TYPE="BUTTON" CLASS="EDIT" VALUE="SHOW FILTER DIALOG"
OnClick="ToggleFilter('dfilter',1);"><form NAME="dfilter" ACTION="$PHP_SELF"
STYLE="display: none;">
<table BORDER="0">
.
.[some content]
.
<tr><td><input TYPE="BUTTON" CLASS="EDIT" VALUE="HIDE FILTER DIALOG"
OnClick="ToggleFilter('dfilter',0);"></td></tr>
</table></form>
and the ToggleFilter() function in an external JS file:
function ToggleFilter(filterForm,isOn) {
if (isOn == 1) {
document.forms[filterForm].style.display = "inline";
} else {
document.forms[filterForm].style.display = "none";
}
}
The above code should display my form when isOn == 1 and hide it in any other
case. While the showing works OK, there is a problem with hiding the form back.
JSEngine in Mozilla doesn't do anything although the "else" part is fired
(tested with some other code). JS Console reports no errors/warnings/whatever
In MS Internet Explorer 5.x/6 everything works smooth.
Tested mozilla builds: 0.9.6, 0.9.8, 1.0 RC1, 1.0 final, 1.1 alpha (build
2002070204) and 1.1 alpha (build: 2002070708)
Comment 1•22 years ago
|
||
If you use "block" instead of "inline" to show, does it work?
Comment 3•22 years ago
|
||
Also seems to work if you remove the table code.
Comment 4•22 years ago
|
||
To layout. I'll investigate in more detail tomorrow....
Assignee: rogerl → attinasi
Component: JavaScript Engine → Layout
QA Contact: pschwartau → petersen
Summary: Unable to set "display" style prop. from JS code → {ib}Unable to set "display" style prop. from JS code
Yes, it works if changed from "inline" to "block".
However, it should work with both.
Comment 6•22 years ago
|
||
Should it? If you switch FORM to "display: inline" then you're saying an inline
element (FORM) should contain a block element (TABLE). That can't be right.
-> INVALID
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Comment 7•22 years ago
|
||
Reopening. There's nothing wrong with having a block inside an inline (except
in the HTML4 specification, but those are different blocks and inlines).
We should be handling this case; I have not yet figured out what breaks here...
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Comment 8•22 years ago
|
||
OK, this is quite confusing.... I've traced the code, and even calling
RecreateDocElementHierarchy (which succeeds and all that) does not make the
second <input> disappear.....
Could this have something to do with the framestate restoration forms do, by
any chance?
Comment 9•22 years ago
|
||
Attachment #90598 -
Attachment is obsolete: true
Updated•22 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows NT → All
Hardware: PC → All
Comment 10•22 years ago
|
||
I don't know if this is relevant, but this is a simple script I use on an
intranet which toggles the display of a span between none and inline. Works
fine in Moz.
Comment 11•22 years ago
|
||
Lasse, your testcase has no blocks inside the <span>. Hence it works.
Updated•22 years ago
|
QA Contact: petersen → moied
Comment 12•22 years ago
|
||
*** Bug 163451 has been marked as a duplicate of this bug. ***
Updated•22 years ago
|
Target Milestone: --- → Future
Comment 13•22 years ago
|
||
*** Bug 174704 has been marked as a duplicate of this bug. ***
Comment 14•22 years ago
|
||
I've encountered this bug while developing a product for IBM which generates
HTML output. I've attached a small testcase. The 'click to flip' link works
only once (in IE it works repeatedly). Note that everything works fine if the
table is removed.
Since I need to hide/reveal the entire table, the workaround I've found is
marking the <table> itself as the element to hide/reveal, without an enclosing
<span>. It seems to work with Mozilla 1.1. Has anyone tried this before and
encountered any problems?
I realize this workaround can probably be used in general when you have to play
around with whole blocks (just replace the <span> with a single-cell <table>),
but the bug itself seems painful and must be solved.
Comment 15•22 years ago
|
||
tal, you're not seeing this bug. You're seeing bug 146409 or something it
blocks (as in, my build with the patch for that bug works fine on your testcase
but fails the testcase in comment 9).
In general, testing this bug without a build with that patch or equivalent is
pointless, since the almost all occurrences of these symptoms are fixed by that
patch...
Comment 16•22 years ago
|
||
Looks fixed by bug 171830
*** This bug has been marked as a duplicate of 171830 ***
Status: NEW → RESOLVED
Closed: 22 years ago → 22 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•