Skip to content

Commit 0c2f6e3

Browse files
committed
Slight cleanup / optimization for flot#1084.
1 parent 82f28d2 commit 0c2f6e3

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

jquery.colorhelpers.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,15 @@
7474
// if it's "transparent"
7575
$.color.extract = function (elem, css) {
7676
var c;
77-
var parentElm;
77+
7878
do {
7979
c = elem.css(css).toLowerCase();
8080
// keep going until we find an element that has color, or
8181
// we hit the body or root (have no parent)
8282
if (c != '' && c != 'transparent')
8383
break;
84-
parentElm = elem.parent();
85-
if (null == parentElm.get(0)) {
86-
break;
87-
}
88-
elem = parentElm;
89-
} while (!$.nodeName(elem.get(0), "body"));
84+
elem = elem.parent();
85+
} while (elem.length && !$.nodeName(elem.get(0), "body"));
9086

9187
// catch Safari's way of signalling transparent
9288
if (c == "rgba(0, 0, 0, 0)")

0 commit comments

Comments
 (0)