diff options
author | Manolo Carrasco <manolo@apache.org> | 2011-07-29 06:40:26 +0000 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2011-07-29 06:40:26 +0000 |
commit | b11dbfa69f5b5222a204ade7b920bd503177730d (patch) | |
tree | b77d2e859e6d331f308e3e99e2f4b131828a0a0a /gwtquery-core | |
parent | 1ab8c0614fc387bb25af3868624d5da8727bdc84 (diff) | |
download | gwtquery-b11dbfa69f5b5222a204ade7b920bd503177730d.tar.gz gwtquery-b11dbfa69f5b5222a204ade7b920bd503177730d.zip |
use default display value instead of "block", fixes issue94
Diffstat (limited to 'gwtquery-core')
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java | 3 | ||||
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java index cdc8cbee..3aab0c5c 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java @@ -3350,7 +3350,8 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { "oldDisplay", null), ""));
// When the display=none is in the stylesheet.
if (!styleImpl.isVisible(e)) {
- styleImpl.setStyleProperty(e, "display", "block");
+ styleImpl.setStyleProperty(e, "display",
+ styleImpl.defaultDisplay(e.getNodeName()));
}
}
return this;
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java index e554f4ae..730026b2 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java @@ -15,9 +15,12 @@ */ package com.google.gwt.query.client.impl; +import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.query.client.GQuery; +import com.google.gwt.query.client.js.JsNamedArray; import com.google.gwt.query.client.js.JsUtils; +import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Window; /** @@ -185,4 +188,24 @@ public class DocumentStyleImpl { return cStyle ? cStyle.getPropertyValue(hyphenName) : null; }-*/; + protected static final JsNamedArray<String> elemdisplay = JsNamedArray.create(); + + /** + * Returns the default display value for each html tag. + */ + public String defaultDisplay(String tagName) { + String ret = elemdisplay.get(tagName); + if (ret == null) { + Element e = DOM.createElement(tagName); + Document.get().getBody().appendChild(e); + ret = curCSS(e, "display", false); + e.removeFromParent(); + if (ret == null || ret.matches("(|none)")) { + ret = "block"; + } + elemdisplay.put(tagName, ret); + } + return ret; + } + } |