This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function buildCSSProperties() { | |
| var used = {}; // hash table lookup instead of scanning the list | |
| var properties = []; // build the properties ourselves | |
| var style = document.documentElement.style; // cache the style, prevent numerous property lookups | |
| var list = document.defaultView.getComputedStyle(document.documentElement, ""); | |
| var length = list.length; | |
| for (var i = 0; i < length; ++i) // fill the hash table early with known values | |
| used[properties[i] = list[i]] = true; // combine statements (1) mark as used (2) add to list | |
| for (var i = 0, end = length; i < length; ++i) { // keep end pointer to prevent push() calls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getStyle(el, styleProp) { | |
| var value, defaultView = el.ownerDocument.defaultView; | |
| // W3C standard way: | |
| if (defaultView && defaultView.getComputedStyle) { | |
| // sanitize property name to css notation (hypen separated words eg. font-Size) | |
| styleProp = styleProp.replace(/([A-Z])/g, "-$1").toLowerCase(); | |
| return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); | |
| } else if (el.currentStyle) { // IE | |
| // sanitize property name to camelCase | |
| styleProp = styleProp.replace(/\-(\w)/g, function(str, letter) { |
NewerOlder