-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathNode.java
More file actions
102 lines (88 loc) · 2.55 KB
/
Node.java
File metadata and controls
102 lines (88 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package snap.webapi;
/**
* This class is a wrapper for Web API Node (https://developer.mozilla.org/en-US/docs/Web/API/Node).
*/
public class Node extends JSProxy {
/**
* Constructor.
*/
public Node()
{
super();
}
/**
* Constructor.
*/
public Node(Object jsObj)
{
super(jsObj);
}
/**
* Returns the node name: e.g.: div, img, canvas.
*/
public String getNodeName() { return getMemberString("nodeName"); }
/**
* Returns the parent node.
*/
public Node getParentNode()
{
Object parentNodeJS = getMember("parentNode");
return parentNodeJS != null ? new HTMLElement(parentNodeJS) : null;
}
/**
* Add given child node.
*/
public void appendChild(Node childNode) { call("appendChild", childNode._jsObj); }
/**
* Remove given child node.
*/
public void removeChild(Node childNode) { call("removeChild", childNode._jsObj); }
/**
* Returns a copy of this node.
*/
public Node cloneNode(boolean deep)
{
Object jsObj = call("cloneNode", deep);
String nodeName = getNodeName();
return HTMLElement.getElementForName(nodeName, jsObj);
}
/**
* Returns a new node for given JS node.
*/
public static Node getNodeForNodeJS(Object jsObj)
{
String nodeName = WebEnv.get().getMemberString(jsObj, "nodeName");
if (nodeName.equals("#text"))
return new Text(jsObj);
return HTMLElement.getElementForName(nodeName, jsObj);
}
/**
* Returns the text content property of the node.
*/
public String getTextContent() { return getMemberString("textContent"); }
/**
* Sets the text content property of the node.
*/
public void setTextContent(String var1) { setMemberString("textContent", var1); }
//String getNodeValue();
//void setNodeValue(String var1);
//short getNodeType();
//NodeList<Node> getChildNodes();
//Node getFirstChild();
//Node getLastChild();
//Node getPreviousSibling();
//Node getNextSibling();
//NamedNodeMap<Attr> getAttributes();
//Node insertBefore(Node var1, Node var2);
//Node replaceChild(Node var1, Node var2);
//boolean hasChildNodes();
//boolean hasChildNodesJS();
//void normalize();
//boolean isSupported(String var1, String var2);
//String getNamespaceURI();
//String getPrefix();
//void setPrefix(String var1);
//String getLocalName();
//boolean hasAttributes();
//Document getOwnerDocument();
}