diff --git a/jquery.colorhelpers.js b/jquery.colorhelpers.js index d3524d7..61c6806 100644 --- a/jquery.colorhelpers.js +++ b/jquery.colorhelpers.js @@ -74,13 +74,18 @@ // if it's "transparent" $.color.extract = function (elem, css) { var c; + var parentElm; do { c = elem.css(css).toLowerCase(); // keep going until we find an element that has color, or - // we hit the body + // we hit the body or root (have no parent) if (c != '' && c != 'transparent') break; - elem = elem.parent(); + parentElm = elem.parent(); + if (null == parentElm.get(0)) { + break; + } + elem = parentElm; } while (!$.nodeName(elem.get(0), "body")); // catch Safari's way of signalling transparent