use of com.gargoylesoftware.htmlunit.javascript.NamedNodeMap in project htmlunit by HtmlUnit.
the class Element method setAttributeNode.
/**
* Sets the attribute node for the specified attribute.
* @param newAtt the attribute to set
* @return the replaced attribute node, if any
*/
@JsxFunction
public Attr setAttributeNode(final Attr newAtt) {
final String name = newAtt.getName();
final NamedNodeMap nodes = getAttributes();
final Attr replacedAtt = (Attr) nodes.getNamedItemWithoutSytheticClassAttr(name);
if (replacedAtt != null) {
replacedAtt.detachFromParent();
}
final DomAttr newDomAttr = newAtt.getDomNodeOrDie();
getDomNodeOrDie().setAttributeNode(newDomAttr);
return replacedAtt;
}
Aggregations