ie8-getcomputedstyle
Advanced tools
Comparing version 0.1.0 to 0.1.2
70
index.js
@@ -0,34 +1,38 @@ | ||
'use strict'; | ||
function shimComputedStyle() { | ||
// ES5 15.4.4.19 | ||
// https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle | ||
if (!global.getComputedStyle) { | ||
// ES5 15.4.4.19 | ||
// https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle | ||
function getComputedStyle(el, pseudo) { | ||
function argsToUppercase() { | ||
return arguments[2].toUpperCase(); | ||
} | ||
if (global.getComputedStyle) { | ||
return; //nope | ||
} | ||
function getPropertyValue(prop) { | ||
function getComputedStyle(el) { | ||
var re = /(\-([a-z]){1})/g; | ||
if (prop == 'float') { | ||
prop = 'styleFloat'; | ||
function argsToUppercase() { | ||
return arguments[2].toUpperCase(); | ||
} | ||
if (re.test(prop)) { | ||
prop = prop.replace(re, argsToUppercase); | ||
function getPropertyValue(prop) { | ||
var re = /(\-([a-z]){1})/g; | ||
return el.currentStyle[prop] ? el.currentStyle[prop] : null; | ||
} | ||
this.el = el; | ||
this.getPropertyValue = getPropertyValue; | ||
return this; | ||
if (prop === 'float') { | ||
prop = 'styleFloat'; | ||
} | ||
if (re.test(prop)) { | ||
prop = prop.replace(re, argsToUppercase); | ||
return el.currentStyle[prop] ? el.currentStyle[prop] : null; | ||
} | ||
this.el = el; | ||
this.getPropertyValue = getPropertyValue; | ||
return this; | ||
} | ||
} | ||
global.getComputedStyle = getComputedStyle; | ||
} | ||
} | ||
@@ -38,14 +42,14 @@ | ||
(function supportModuleTypes(definition, context) { | ||
// RequireJS | ||
if (typeof module != 'undefined' && module.exports) { | ||
module.exports = definition(); | ||
} else if (typeof define == 'function') { | ||
define(definition); | ||
// YUI3 | ||
} else if (typeof YUI == 'function') { | ||
YUI.add('es5', definition); | ||
// CommonJS and <script> | ||
} else { | ||
definition(); | ||
} | ||
// RequireJS | ||
if (typeof module != 'undefined' && module.exports) { | ||
module.exports = definition(); | ||
} else if (typeof define == 'function') { | ||
define(definition); | ||
// YUI3 | ||
} else if (typeof YUI == 'function') { | ||
YUI.add('es5', definition); | ||
// CommonJS and <script> | ||
} else { | ||
definition(); | ||
} | ||
})(shimComputedStyle); |
{ | ||
"name": "ie8-getcomputedstyle", | ||
"version": "0.1.0", | ||
"version": "0.1.2", | ||
"description": "A Shim for the getComputedStyle function for Interenet Explorer 8", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git+ssh://git@github.com/the-simian/ie8-shim-getcomputedstyles.git" | ||
"url": "git+ssh://git@github.com/the-simian/ie8-getcomputedstyle.git" | ||
}, | ||
@@ -23,5 +23,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/the-simian/ie8-shim-getcomputedstyles/issues" | ||
"url": "https://github.com/the-simian/ie8-getcomputedstyle/issues" | ||
}, | ||
"homepage": "https://github.com/the-simian/ie8-shim-getcomputedstyles#readme" | ||
"homepage": "https://github.com/the-simian/ie8-getcomputedstyle#readme" | ||
} |
@@ -1,2 +0,2 @@ | ||
#IE8 Shim getComputedStyle | ||
#IE8 getComputedStyle() | ||
@@ -3,0 +3,0 @@ Do you want a shim for getComputedStyle that works with browserify/webpack? |
2275
4
42