/** * Creates a new attribute with the specified name. * * @param name the name of the new attribute object * @return the new attribute object */ @JsxFunction public Object createAttribute(final String name) { if (name == null || "null".equals(name)) { throw Context.reportRuntimeError("Type mismatch."); } if (StringUtils.isBlank(name) || name.indexOf('<') >= 0 || name.indexOf('>') >= 0) { throw Context.reportRuntimeError("To create a node of type ATTR a valid name must be given."); } final DomAttr domAttr = getPage().createAttribute(name); return getScriptableFor(domAttr); }
/** * Creates a new HTML attribute with the specified name. * * @param attributeName the name of the attribute to create * @return an attribute with the specified name */ @JsxFunction public Attr createAttribute(final String attributeName) { return getPage().createAttribute(attributeName).getScriptableObject(); }
/** * Creates a new attribute with the specified name. * * @param name the name of the new attribute object * @return the new attribute object */ @JsxFunction public Object createAttribute(final String name) { if (name == null || "null".equals(name)) { throw Context.reportRuntimeError("Type mismatch."); } if (StringUtils.isBlank(name) || name.indexOf('<') >= 0 || name.indexOf('>') >= 0) { throw Context.reportRuntimeError("To create a node of type ATTR a valid name must be given."); } final DomAttr domAttr = getPage().createAttribute(name); return getScriptableFor(domAttr); }
/** * Creates a new HTML attribute with the specified name. * * @param attributeName the name of the attribute to create * @return an attribute with the specified name */ @JsxFunction public Attr createAttribute(final String attributeName) { return getPage().createAttribute(attributeName).getScriptableObject(); }
private void updateAttribute(final String value) { final DomElement domNode = (DomElement) getDomNodeOrDie(); DomAttr attr = (DomAttr) domNode.getAttributes().getNamedItem(attributeName_); if (null == attr) { attr = domNode.getPage().createAttribute(attributeName_); domNode.setAttributeNode(attr); } attr.setValue(value); }
private void updateAttribute(final String value) { final DomElement domNode = (DomElement) getDomNodeOrDie(); DomAttr attr = (DomAttr) domNode.getAttributes().getNamedItem(attributeName_); if (null == attr) { attr = domNode.getPage().createAttribute(attributeName_); domNode.setAttributeNode(attr); } attr.setValue(value); }