I'm trying to develop a jQuery plugin that utilizes CSS values and modifies them. The problem, however, is that Firefox and Opera seem to not like keeping track of the units of the property's value. In Retrieving percentage CSS values (in firefox), the asker wants to get the percentage of a CSS property. I want to get the CSS property as a percentage with javascript if it's specified as a percentage in its CSS or as pixels if it's specified as pixels. I don't want to rely on any libraries other than jQuery, although it doesn't seem to be able to do what I'm wanting either.
CSS
#element{
margin-left: 10%;
}
Javascript
$('#element').css('margin-left'); // returns 29px in Firefox, but 10% in Chrome
getComputedStyle(document.getElementById('element')).getPropertyValue('margin-left'); // returns 29px in Firefox, but 10% in Chrome