Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (cssPropertyParsers) {
// The shorthandParser function should never return a string, but it
// does when given an empty string. Here we detect that case and make it
// return an empty object instead, to work around bugs in later code
// that assume the result of shorthandParser is always an object.
var shorthandParser = cssPropertyParsers.shorthandParser;
cssPropertyParsers.shorthandParser = function() {
var result = shorthandParser.apply(this, arguments);
return result === '' ? {} : result;
};
// Current versions of the cssstyle parseInteger function can't actually
// handle string inputs.
var badInt = cssPropertyParsers.parseInteger('5');
if (badInt !== '5') {
cssPropertyParsers.parseInteger = function parseInteger(val) {
return String(parseInt(val, 10));
};
}
// Current versions of the cssstyle parseNumber function can't actually
// handle string inputs.
var badNum = cssPropertyParsers.parseNumber('0.5');
if (badNum !== '0.5') {
cssPropertyParsers.parseNumber = function parseNumber(val) {
return String(parseFloat(val, 10));
};
}
}