setVisible issues with Firefox, then display: none !important

106 views
Skip to first unread message

Domenec

unread,
Jun 12, 2012, 7:39:40 AM6/12/12
to Google Web Toolkit
Hello,

about to deploy to production an evolution of a project, customer
calls and says "hidding icons fails in Firefox". What?

Firebug to the rescue says the icons have a nice "display: none" after
I call setVisible(false).

Changing by hand to display: none !important works and I accept it as
a solution (did I say that I start holidays on friday evening and
kitesurfing sounds a better idea than coding in a cybercafe?)

I tried a custom setVisibilitat method that does setVisible and
getElement().getStyle().setProperty("display","none !important") if
needed, but this fails, see generated JavaScript for details:

function $setVisibilitat(this$static, visible){
var style;
// This is setVisible(false);
this$static.element.style.display = visible?'':'none';
if (!visible) {
// This is Style style=getElement().getStyle();
style.setProperty("display","none !important");
style = this$static.element.style;
style['display'] = 'none !important';
}
}

The if ( !visible) above executes but fails and leaves display:none. I
wonder whether the reason is this difference
this$static.element.style.display =
versus
style = this$static.element.style;
style['display'] =
Notice the dot property against the array property.

Sorry, what? Did I hear someone talking about setDisplay(Display d)?
Well, according to this the enum does not cover the !important thing:
http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/dom/client/Style.Display.html

So far, a good solution will be managing some way of programatically
setting the !important bit, but my Google mojo wasn't able to find it.
Ideas are welcome.

In the end, I think I could have defined some sytle that has the
display: none !important, but don't like adding that many styles and
(don't tell anybody) I programatically got the style, looked for
display: none and added in place !important, keeping all other style
properties. Works. Holidays. Kitesurf :)

Joseph Lust

unread,
Jun 13, 2012, 11:32:27 AM6/13/12
to google-we...@googlegroups.com
If that is causing so much trouble, how about just use a CSS class like visibleIcon. Leave the visibility/display property changing to the browser by adding/removing a class name.


Joseph
Reply all
Reply to author
Forward
0 new messages