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)

defect

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)
If you use "block" instead of "inline" to show, does it work?
Re: comment 1 - Yes, I tested it with block, and it works.
Also seems to work if you remove the table code.
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.
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
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 → ---
Attached file Minimal testcase (obsolete) (deleted) —
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?
Attached file same without form controls. :( (deleted) —
Attachment #90598 - Attachment is obsolete: true
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows NT → All
Hardware: PC → All
Attached file This one works.. (deleted) —
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.
Lasse, your testcase has no blocks inside the <span>. Hence it works.
QA Contact: petersen → moied
Priority: -- → P4
*** Bug 163451 has been marked as a duplicate of this bug. ***
Target Milestone: --- → Future
*** Bug 174704 has been marked as a duplicate of this bug. ***
Attached file Small testcase (deleted) —
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.
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...
Looks fixed by bug 171830 *** This bug has been marked as a duplicate of 171830 ***
Status: NEW → RESOLVED
Closed: 22 years ago22 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: