/** * Set a key/value object as properties to all matched elements. * * Example: $("img").attr(new Properties("src: 'test.jpg', alt: 'Test Image'")) */ public GQuery attr(Properties properties) { for (String name : properties.keys()) { attr(name, properties.getStr(name)); } return this; }
/** * Set a key/value object as style properties to all matched elements. This serves as the best way * to set a large number of style properties on all matched elements. You can use either js maps * or pure css syntax. * * Example: * * <pre class="code"> * $(".item").css(Properties.create("color: 'red', background:'blue'")) * $(".item").css(Properties.create("color: red; background: blue;")) * </pre> */ public GQuery css(Properties properties) { for (String property : properties.keys()) { css(property, properties.getStr(property)); } return this; }
public static List<String> filterTransitionPropertyNames(Properties p) { List<String> ret = new ArrayList<String>(); for (String s : p.keys()) { if (invalidTransitionNamesRegex.test(s)) { continue; } String c = JsUtils.camelize(s); // marginLeft, marginRight ... -> margin String m = property(c); if (m != null) { c = m; } // chrome needs transition:-webkit-transform instead of transition:transform c = JsUtils.hyphenize(c); if (!ret.contains(c)) { ret.add(c); } } return ret; }
@Override public void onStart() { effects = JsObjectArray.create(); boolean resize = false; boolean move = false; boolean hidden = !g.isVisible(); Fx fx; // g.show(); for (String key : prps.keys()) { String val = prps.getStr(key); if ((fx = getFx(e, key, val, hidden)) != null) { effects.add(fx); resize = resize || "height".equals(key) || "width".equals(key); move = move || "top".equals(key) || "left".equals(key); } } g.saveCssAttrs(ATTRS_TO_SAVE); if (resize) { g.css("overflow", "hidden"); } if (move && !g.css("position", true).matches("absolute|relative|fixed")) { g.css("position", "relative"); } super.onStart(); }
for (String k : prop.keys()) { String ky = k.matches("\\d+") ? k : "\"" + k + "\""; JsCache o = prop.getArray(k).cast();
Properties prop = js.cast(); String ret = ""; for (String k : prop.keys()) { ret += ret.isEmpty() ? "" : "&"; JsCache o = prop.getArray(k).cast();