示例#1
0
文件: Attr.java 项目: xinl/HTMLUnit
 /** Detaches this attribute from the parent HTML element after caching the attribute value. */
 public void detachFromParent() {
   final DomAttr domNode = getDomNodeOrDie();
   final DomElement parent = (DomElement) domNode.getParentNode();
   if (parent != null) {
     domNode.setValue(parent.getAttribute(jsxGet_name()));
   }
   domNode.remove();
 }
示例#2
0
 /**
  * Retrieves an attribute node by name.
  *
  * @param name the name of the attribute to retrieve
  * @return the XMLAttr node with the specified name or <code>null</code> if there is no such
  *     attribute
  */
 @JsxFunction
 public Object getAttributeNode(final String name) {
   final Map<String, DomAttr> attributes = getDomNodeOrDie().getAttributesMap();
   for (final DomAttr attr : attributes.values()) {
     if (attr.getName().equals(name)) {
       return attr.getScriptObject();
     }
   }
   return null;
 }