let next_property_id = 1; // Generate a unique property name on the form --prop-N. function generate_name() { return `--prop-${next_property_id++}`; } // Produce a compatible initial value for the specified syntax. function any_initial_value(syntax) { let components = syntax.split('|').map(x => x.trim()) let first_component = components[0]; if (first_component.endsWith('+') || first_component.endsWith('#')) first_component = first_component.slice(0, -1); switch (first_component) { case '*': case '': return 'NULL'; case '': return '0deg'; case '': return 'rgb(0, 0, 0)'; case '': case '': return 'url(0)'; case '': case '': case '': case '': return '0'; case '': return '0%'; case '': return '0dpi'; case '