You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
674 B

2 years ago
  1. "use strict";
  2. var pattern = /-(\w|$)/g;
  3. var callback = function callback(dashChar, char) {
  4. return char.toUpperCase();
  5. };
  6. var camelCaseCSS = function camelCaseCSS(property) {
  7. property = property.toLowerCase();
  8. // NOTE :: IE8's "styleFloat" is intentionally not supported
  9. if (property === "float") {
  10. return "cssFloat";
  11. }
  12. // Microsoft vendor-prefixes are uniquely cased
  13. else if (property.charCodeAt(0) === 45&& property.charCodeAt(1) === 109&& property.charCodeAt(2) === 115&& property.charCodeAt(3) === 45) {
  14. return property.substr(1).replace(pattern, callback);
  15. } else {
  16. return property.replace(pattern, callback);
  17. }
  18. };
  19. module.exports = camelCaseCSS;