Keine Beschreibung

name-quotes.js 914B

12345678910111213141516171819202122232425262728293031323334353637
  1. (function() {
  2. var QuoteScanner = require('./quote-scanner');
  3. var PropertyScanner = require('../properties/scanner');
  4. var NameQuotes = function NameQuotes() {};
  5. var STRIPPABLE = /^['"][a-zA-Z][a-zA-Z\d\-_]+['"]$/;
  6. var properties = [
  7. 'animation',
  8. '-moz-animation',
  9. '-o-animation',
  10. '-webkit-animation',
  11. 'animation-name',
  12. '-moz-animation-name',
  13. '-o-animation-name',
  14. '-webkit-animation-name',
  15. 'font',
  16. 'font-family'
  17. ];
  18. NameQuotes.prototype.process = function(data) {
  19. var scanner = new PropertyScanner(data);
  20. return new QuoteScanner(data).each(function(match, store, cursor) {
  21. var lastProperty = scanner.nextAt(cursor);
  22. if (properties.indexOf(lastProperty) > -1) {
  23. if (STRIPPABLE.test(match))
  24. match = match.substring(1, match.length - 1);
  25. }
  26. store.push(match);
  27. });
  28. };
  29. module.exports = NameQuotes;
  30. })();