return JsUtils.camelize(name);
}
+ // inline elements do not have width nor height unless we set it to inline-block
+ private void fixInlineElement(Element e) {
+ if (e.getClientHeight() == 0 && e.getClientWidth() == 0 && "inline".equals(curCSS(e, "display", true))) {
+ setStyleProperty(e, "display", "inline-block");
+ setStyleProperty(e, "width", "auto");
+ setStyleProperty(e, "height", "auto");
+ }
+ }
+
public int getHeight(Element e) {
+ fixInlineElement(e);
return (int) (e.getClientHeight() - num(curCSS(e, "paddingTop", true)) - num(curCSS(e, "paddingBottom", true)));
}
}
public int getWidth(Element e) {
+ fixInlineElement(e);
return (int) (e.getClientWidth() - num(curCSS(e, "paddingLeft", true)) - num(curCSS(e, "paddingRight", true)));
}
assertEquals(142, g.outerWidth(true));
}
+
+ public void testWidthHeightInlineElement() {
+ $(e).html(
+ "<span style='border: 1px solid red; padding: 10px; margin:10px'>Content 1</span>");
+ GQuery g = $("span", e);
+ assertTrue(g.width() > 0);
+ assertTrue(g.height() > 0);
+ }
public void testWrapMethod() {
String content = "<p>Test Paragraph.</p>";