Skip to content

Instantly share code, notes, and snippets.

View cms's full-sized avatar

Christian C. Salvadó cms

View GitHub Profile
(function () {
var frameworks = {
'MooTools Core': 'MooTools.version',
'MooTools More': 'MooTools.More.version',
'Base2': 'base2.version',
'Dojo': 'dojo.version',
'Ext JS': 'Ext.version',
'jQuery': 'jQuery.fn.jquery',
'jQuery UI': 'jQuery.ui.version',
'MochKit': 'MochiKit.MochiKit.VERSION',
@cms
cms / getStyle.js
Created April 17, 2010 00:48
Get computed styles
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) {