package com.google.gwt.query.client.impl;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.js.JsUtils;
+import com.google.gwt.user.client.Window;
/**
* A helper class to get computed CSS styles for elements.
* - Otherwise it returns the real computed value.
*/
public double cur(Element elem, String prop, boolean force) {
+ if (elem.equals(GQuery.window)) {
+ if ("width".equals(prop)) {
+ return Window.getClientWidth();
+ }
+ if ("height".equals(prop)) {
+ return Window.getClientHeight();
+ }
+ elem = GQuery.body;
+ }
if (elem.getPropertyString(prop) != null
&& (elem.getStyle() == null || elem.getStyle().getProperty(prop) == null)) {
return elem.getPropertyDouble(prop);
assertEquals("div", m.get(5).get(0).toLowerCase());
assertEquals("i", m.get(0).get(0).toLowerCase());
}
-
+
+ public void testWindowSize() {
+ GQuery w = $(GQuery.window);
+ assertTrue(w.width() > 0);
+ assertTrue(w.height() > 0);
+ }
}