assets/js/romo/base.js in romo-0.16.2 vs assets/js/romo/base.js in romo-0.17.0

- old
+ new

@@ -146,21 +146,23 @@ [/%7E/g, '~'] ]; // style handling + Romo.prototype.getComputedStyle = function(node, styleName) { + return window.getComputedStyle(node, null).getPropertyValue(styleName); + } + Romo.prototype.parseZIndex = function(elem) { // for the case where z-index is set directly on the elem var val = this.parseElemZIndex(elem); if (val !== 0) { return val; } // for the case where z-index is inherited from a parent elem - var parentIndexes = $.map(elem.parents(), function(item) { - return item; // converts the collection to an array - }).reduce($.proxy(function(prev, curr) { + var parentIndexes = this.toArray(elem.parents()).reduce($.proxy(function(prev, curr) { var pval = this.parseElemZIndex($(curr)); if (pval !== 0) { prev.push(pval); } return prev; @@ -168,14 +170,21 @@ parentIndexes.push(0); // in case z-index is 'auto' all the way up return parentIndexes[0]; } Romo.prototype.parseElemZIndex = function(elem) { - var val = parseInt(document.defaultView.getComputedStyle(elem[0], null).getPropertyValue("z-index")); + var val = parseInt(this.getComputedStyle(elem[0], "z-index")); if (!isNaN(val)) { return val; } return 0; + } + + // elem handling + + Romo.prototype.toArray = function(elems) { + // converts a collection of elements (`$()`) to an array of nodes + return $.map(elems, function(node){ return node; }) } // private Romo.prototype._addEventCallback = function(name, callback) {