You should not really do or even need it in a real application, but since you say it is just for fun; here is the interesting part:
Yes you can do it. Loading a CSS file using AJAX calls is not the only way, but it may be the only (but inefficient) way to make it truly cross-browser. Even the declaration below will not make it truly a cross browser, since the calc() function is not supported by everyone , and it is a CSS3 function.
div { width: 300px; width: -webkit-calc(100% - 50px); width: -moz-calc(100% - 50px); width: calc(100% - 50px); }
You can get CSS source code from document.styleSheets and their rules. The cssText property of the rule will give you a full report. But different browsers can analyze values using the calc() function in different ways.
I'll go with a more complex example to see how the browser handles the calc() function:
calc(100% - -50px*6 + 4em/2);
Here's how it relates to Firefox (v.18):

And this is how Google Chrome (v.24) accesses it:

As shown; FF gets the value without the calc prefix as it is, and Chrome takes the -webkit prefix value and -webkit it with nested brackets (if necessary). If you do not declare it -webkit in Chrome; he completely ignores the meaning. Therefore, we must take this into account when manipulating the calc statement.
Now, using a complex example; we first get the statement inside the calc () function:
"100% - -50px*6 + 4em/2"
Then disconnect the elements of the instruction into an array:
["100%", "-", "-50px", "*", "6", "+", "4em", "/", "2"]
Finally, process the values and units of the array elements to make them programmatically useful (as you wanted):
[{ value:100, unit:"%" }, "-", { value:-50, unit:"px" }, "*", { value:6, unit:undefined }, "+", { value:4, unit:"em" }, "/", { value:2, unit:undefined }]
The end result above includes value objects and operators (in order).
Before reading further; note that the code below is not fully tested in all browsers and situations. It does not handle the expansion of nested brackets (e.g. Chrome) or values with multiple or combined calc () functions. If you want to check it out; I recommend Firefox because it does not parse nested parentheses, or you can extend the code to include support for them.
function processRules(sheet) { var rules = sheet.cssRules
function hasCalc(value) { return value.toLowerCase().indexOf('calc(') >= 0; } function getCalcStatement(rule) { if (!rule) return ''; var pattern = /calc\(([^\)]+)\).*/; var match = pattern.exec(rule); return match && match.length > 1 ? match[1] : ''; } function dissolveCalcElements(statement) {
What is it. As I said, I wouldn’t do this, but it’s always good to know if anything is possible.
Note Since you mentioned creating the jQuery plugin (for fun); you don't need jQuery for this. And calling functions like $('div').css('width') will only give the computed value, not the raw calc expression.