Use regular expression to replace all occurrences

This commit is contained in:
David Manzanares 2017-10-10 18:12:01 +02:00
parent 9fb894181d
commit ad5d919139

View File

@ -33,7 +33,7 @@ tree.Value.prototype = {
var val = this.ev(env); var val = this.ev(env);
var v = val.toString(); var v = val.toString();
if(val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') { if(val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') {
v = "'" + v.replace('&', '&') + "'"; v = "'" + v.replace(/&/g, '&') + "'";
} else if (Array.isArray(this.value) && this.value.length > 1) { } else if (Array.isArray(this.value) && this.value.length > 1) {
// This covers something like `line-dasharray: 5, 10;` // This covers something like `line-dasharray: 5, 10;`
// where the return _value has more than one element. // where the return _value has more than one element.