function hasBalancedQuotes(value) {
  let outsideSingle = true;
  let outsideDouble = true;
  for (let i = 0; i < value.length; i++) {
    const c = value.charAt(i);
    if (c == '\'' && outsideDouble) {
      outsideSingle = !outsideSingle;
    } else if (c == '"' && outsideSingle) {
      outsideDouble = !outsideDouble;
    }
  }
  return outsideSingle && outsideDouble;
}
Checks that quotes (" and ') are properly balanced inside a string. Assumes
that neither escape (\) nor any other character that could result in
breaking out of a string parsing context are allowed;
see http://www.w3.org/TR/css3-syntax/#string-token-diagram.
@param {string} value Untrusted CSS property value.
@return {boolean} True if property value is safe with respect to quote
    balancedness.