Sha256: f05334e68c06ea6e4fbabf7f2b2a5bb968f91cf5fcb8270bfe9bf32d88c34c71

Contents?: true

Size: 647 Bytes

Versions: 19

Compression:

Stored size: 647 Bytes

Contents

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

/**
 * Quotes the name.
 * @param {string} name The name to quote.
 * @return {string} The quoted name.
 */
webfont.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

19 entries across 19 versions & 1 rubygems

Version Path
webfontloader-1.3.0 src/core/cssfontfamilyname.js
webfontloader-1.2.1 src/core/cssfontfamilyname.js
webfontloader-1.2.0 src/core/cssfontfamilyname.js
webfontloader-1.1.2 src/core/cssfontfamilyname.js
webfontloader-1.1.1 src/core/cssfontfamilyname.js
webfontloader-1.1.0 src/core/cssfontfamilyname.js
webfontloader-1.0.31 src/core/cssfontfamilyname.js
webfontloader-1.0.30 src/core/cssfontfamilyname.js
webfontloader-1.0.29 src/core/cssfontfamilyname.js
webfontloader-1.0.28 src/core/cssfontfamilyname.js
webfontloader-1.0.27 src/core/cssfontfamilyname.js
webfontloader-1.0.26 src/core/cssfontfamilyname.js
webfontloader-1.0.25 src/core/cssfontfamilyname.js
webfontloader-1.0.24 src/core/cssfontfamilyname.js
webfontloader-1.0.22 src/core/cssfontfamilyname.js
webfontloader-1.0.21 src/core/cssfontfamilyname.js
webfontloader-1.0.20 src/core/cssfontfamilyname.js
webfontloader-1.0.19 src/core/cssfontfamilyname.js
webfontloader-1.0.18 src/core/cssfontfamilyname.js