Sha256: cfaf2660fa560a006c0665475bec7279cbd3cc540c98363ed04b52ee8de18981

Contents?: true

Size: 802 Bytes

Versions: 3

Compression:

Stored size: 802 Bytes

Contents

goog.provide('webfont.CssFontFamilyName');

/**
 * Handles quoting rules for a font family name in css.
 * @constructor
 */
webfont.CssFontFamilyName = function() {
  /** @type {string} */
  this.quote_ = "'";
};

goog.scope(function () {
  var CssFontFamilyName = webfont.CssFontFamilyName;

  /**
   * Quotes the name.
   * @param {string} name The name to quote.
   * @return {string} The quoted name.
   */
  CssFontFamilyName.prototype.quote = function(name) {
    var quoted = [];
    var split = name.split(/,\s*/);
    for (var i = 0; i < split.length; i++) {
      var part = split[i].replace(/['"]/g, '');
      if (part.indexOf(' ') == -1) {
        quoted.push(part);
      } else {
        quoted.push(this.quote_ + part + this.quote_);
      }
    }
    return quoted.join(',');
  };
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webfontloader-1.4.0 src/core/cssfontfamilyname.js
webfontloader-1.3.2 src/core/cssfontfamilyname.js
webfontloader-1.3.1 src/core/cssfontfamilyname.js