/** * Determine an element's node name via the <code>nodeName</code> property. * * @param elem the element whose node name is to be determined * @return the element's node name */ public static String getNodeName(Element elem) { return elem.getNodeName(); }
public boolean f(Element e, int index) { return e.getNodeName().toLowerCase().matches("h\\d"); } });
public boolean f(Element e, int index) { return e.getNodeName().toLowerCase().matches("input|select|textarea|button"); } });
public static boolean isFormElement(Element element) { String elementNodeName = element.getNodeName().toUpperCase(); if ( "SELECT".equals(elementNodeName) || "INPUT".equals(elementNodeName) || "TEXTAREA".equals(elementNodeName)) { return true; } return false; }
public static boolean isHtmlFormControl(com.google.gwt.dom.client.Element ele) { if (ele == null) { return false; } String FromControls = "BUTTON INPUT SELECT TEXTAREA"; String nodeName = ele.getNodeName().toUpperCase(); String roleName = ele.getAttribute("role").toUpperCase(); return FromControls.contains(nodeName) || roleName.length() > 0 && FromControls.contains(roleName) || isHtmlFormControl(ele.getParentElement()); }
/** * Check if an element is a DOM or a XML node. */ public static boolean isXML(Node o) { return o == null ? false : !"HTML".equals(getOwnerDocument(o).getDocumentElement().getNodeName()); }
private void addNode(Node child) { if (!Element.is(child)) { return; } Element e = Element.as(child); if ("OPTGROUP".equalsIgnoreCase(e.getNodeName())) { addGroup(OptGroupElement.as(e)); } else if ("OPTION".equalsIgnoreCase(e.getNodeName())) { addOption(OptionElement.as(e), -1, false); } }
private void addNode(Node child) { if (!Element.is(child)) { return; } Element e = Element.as(child); if ("OPTGROUP".equalsIgnoreCase(e.getNodeName())) { addGroup(OptGroupElement.as(e)); } else if ("OPTION".equalsIgnoreCase(e.getNodeName())) { addOption(OptionElement.as(e), -1, false); } }
private void addNode(Node child) { if (!Element.is(child)) { return; } Element e = Element.as(child); if ("OPTGROUP".equalsIgnoreCase(e.getNodeName())) { addGroup(OptGroupElement.as(e)); } else if ("OPTION".equalsIgnoreCase(e.getNodeName())) { addOption(OptionElement.as(e), -1, false); } }
/** * The scroll top offset is set to the passed value on all matched elements. This method works for * both visible and hidden elements. */ public GQuery scrollTop(int top) { for (Element e : elements) { if (e == window || e.getNodeName() == null || e == (Node) document) { Window.scrollTo($(e).scrollLeft(), top); } else { e.setPropertyInt("scrollTop", top); } } return this; }
private boolean containerMouseUp(Event e) { Element target = e.getEventTarget().cast(); GQuery $e = $(target); if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) { resultsReset(e); return false; } return true; }
private boolean containerMouseUp(Event e) { Element target = e.getEventTarget().cast(); GQuery $e = $(target); if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) { resultsReset(); return false; } return true; }
/** * The scroll left offset is set to the passed value on all matched elements. This method works * for both visible and hidden elements. */ public GQuery scrollLeft(int left) { for (Element e : elements) { if (e == window || e.getNodeName() == null || e == (Node) document) { Window.scrollTo(left, $(e).scrollTop()); } else { e.setPropertyInt("scrollLeft", left); } } return this; }
private boolean containerMouseUp(Event e) { Element target = e.getEventTarget().cast(); GQuery $e = $(target); if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) { resultsReset(); return false; } return true; }
public void setAttribute(Element e, String name, Object value) { String tag = e.getNodeName(); if (NOT_AUTHORIZED_NODE.test(tag) && GQuery.$(e).parents("body").length() > 0) { // TODO maybe it's better to simply do nothing... throw new RuntimeException( "You cannot change type of button or input element if the element is already attached to the dom"); } if ("input".equals(tag.toLowerCase()) && "radio".equals(value)) { // some browser (IE6-9) resets value property of the input when you change the type to radio button InputElement ie = InputElement.as(e); String keepValue = ie.getValue(); super.setAttribute(ie, "type", value); ie.setValue(keepValue); } else { super.setAttribute(e, name, value); } } }
/** * Gets the scroll top offset of the first matched element. This method works for both visible and * hidden elements. */ public int scrollTop() { Element e = get(0); if (e == null) { return 0; } if (e == window || e.getNodeName() == null) { return Window.getScrollTop(); } else if (e == (Node) document) { return document.getScrollTop(); } else { return e.getScrollTop(); } }
/** * Gets the scroll left offset of the first matched element. This method works for both visible * and hidden elements. */ public int scrollLeft() { Element e = get(0); if (e == null) { return 0; } if (e == window || e.getNodeName() == null) { return Window.getScrollLeft(); } else if (e == (Node) document) { return document.getScrollLeft(); } else { return e.getScrollLeft(); } }
private void checkGWTIssue1813(Widget child, AbsolutePanel parent) { if (!GWT.isScript()) { if (child.getElement().getOffsetParent() != parent.getElement() && !"HTML".equals(child.getElement().getOffsetParent().getNodeName())) { DOMUtil.reportFatalAndThrowRuntimeException("The boundary panel for this drag controller does not appear to have" + " 'position: relative' CSS applied to it." + " This may be due to custom CSS in your application, although this" + " is often caused by using the result of RootPanel.get(\"some-unique-id\") as your boundary" + " panel, as described in GWT issue 1813" + " (http://code.google.com/p/google-web-toolkit/issues/detail?id=1813)." + " You can often remedy this problem by adding one line of code to your application:" + " boundaryPanel.getElement().getStyle().setProperty(\"position\", \"relative\");"); } } }
protected void removeData(Element item, String name) { if (dataCache == null) { windowData = JavaScriptObject.createObject().cast(); dataCache = JavaScriptObject.createObject().cast(); } item = item == window || item.getNodeName() == null ? windowData : item; int id = item.hashCode(); if (name != null) { if (dataCache.exists(id)) { dataCache.getCache(id).delete(name); if (dataCache.getCache(id).isEmpty()) { // Save memory removeData(item, null); } } } else { // when the element cache is empty we remove its entry to save memory (issue 132) dataCache.delete(id); } }
private static <T> T data(Element element, String key, T value, Class<? extends T> clz) { if (dataCache == null) { windowData = JavaScriptObject.createObject().cast(); dataCache = JavaScriptObject.createObject().cast(); } element = element == window || element.getNodeName() == null ? windowData : element; if (element != null && key != null) { int id = element.hashCode(); if (value == null) { return dataCache.exists(id) ? dataCache.getCache(id).get(key, clz) : null; } if (!dataCache.exists(id)) { dataCache.put(id, JsCache.createObject().cast()); } dataCache.getCache(id).put(key, value); } return value; }