Skip to content

Instantly share code, notes, and snippets.

@eoneill
Created September 28, 2011 23:23
Show Gist options
  • Save eoneill/1249560 to your computer and use it in GitHub Desktop.
Save eoneill/1249560 to your computer and use it in GitHub Desktop.
IN.$extensions('createStylePatch', function() {
Sslac.definitionOf("IN.Objects.Base").Method("createStyle", function(pairs) {
var ua = navigator.userAgent,
out = [],
value = "",
cssBrowserSupport = ((/Webkit|KHTML\//i).test(ua)) ? "Webkit" :
((/Gecko\/([^\s]*)/i).test(ua)) ? "Gecko" :
((/MSIE\s([^;]*)/).test(ua)) ? "MSIE" :
(window.opera) ? "Opera" : "other";
for (var name in pairs) {
if (typeof(pairs[name]) == "object") {
value = pairs[name][cssBrowserSupport] || pairs[name]["other"];
}
else {
value = pairs[name];
}
// skip empty assignments
if (!value) {
continue;
}
out[out.length] = name+":"+value+" !important; ";
}
return out.join("");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment