Skip to content

Commit 928951b

Browse files
hansonrhansonr
authored andcommitted
DOMNode.getAttr fix for returning "" not null
1 parent 8cd9407 commit 928951b

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

sources/net.sf.j2s.java.core/src/swingjs/api/js/DOMNode.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,17 @@ public static DOMNode setZ(DOMNode node, int z) {
7676
}
7777

7878
public static Object getAttr(DOMNode node, String attr) {
79-
return (/** @j2sNative node && node[attr] ||*/ null);
79+
/**
80+
* @j2sNative
81+
*
82+
* if (!node)
83+
* return null;
84+
* var a = node[attr];
85+
* return (typeof a == "undefined" ? null : a);
86+
*/
87+
{
88+
return null;
89+
}
8090
}
8191

8292
public static int getAttrInt(DOMNode node, String attr) {

0 commit comments

Comments
 (0)