Skip to content

Commit c062412

Browse files
hansonrhansonr
authored andcommitted
DOMNode setStyles optimization
1 parent d56fca9 commit c062412

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,10 @@ public static DOMNode setStyles(DOMNode node, String... av) {
207207
/**
208208
* @j2sNative
209209
*
210-
* if (node) for (var i = 0; i < av.length;) {
211-
* node.style[av[i++]] = av[i++];
212-
* }
210+
if (node)for (var i = 0, n = av.length; i < n;) {
211+
var k = av[i++], v = av[i++];
212+
node.style[k] != v && (node.style[k] = v);
213+
}
213214
*
214215
*/
215216
return node;

0 commit comments

Comments
 (0)