From f80af3721c13e7c9d5e8f629bc7ae9418be8d31c Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 28 Aug 2017 12:22:45 +0300 Subject: [PATCH] csslint: fix hsl/hsla regexp as per spec * hue can be deg, %, rad, grad, turn - deg is default * all numbers can be fractional * hsla = hsl --- vendor-overwrites/csslint/csslint-worker.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/vendor-overwrites/csslint/csslint-worker.js b/vendor-overwrites/csslint/csslint-worker.js index ea379494..974d1cc5 100644 --- a/vendor-overwrites/csslint/csslint-worker.js +++ b/vendor-overwrites/csslint/csslint-worker.js @@ -4180,16 +4180,12 @@ function PropertyValuePart(text, line, col, optionalHint) { this.green = +RegExp.$2 * 255 / 100; this.blue = +RegExp.$3 * 255 / 100; this.alpha = +RegExp.$4; - } else if (/^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)) { //hsl() + } else if (/hsla?\(\s*(-?\d+|-?\d*\.\d+)(%|deg|g?rad|turn|)\s*,\s*(-?\d+|-?\d*\.\d+)%\s*,\s*(-?\d+|-?\d*\.\d+)%(?:\s*,\s*(-?\d+|-?\d*\.\d+))?\s*\)/i.test(text)) { //hsla() color this.type = "color"; this.hue = +RegExp.$1; - this.saturation = +RegExp.$2 / 100; - this.lightness = +RegExp.$3 / 100; - } else if (/^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)) { //hsla() color with percentages - this.type = "color"; - this.hue = +RegExp.$1; - this.saturation = +RegExp.$2 / 100; - this.lightness = +RegExp.$3 / 100; + this.hueUnit = +RegExp.$2; + this.saturation = +RegExp.$3 / 100; + this.lightness = +RegExp.$4 / 100; this.alpha = +RegExp.$4; } else if (/^url\(("([^\\"]|\\.)*")\)/i.test(text)) { //URI // generated by TokenStream.readURI, so always double-quoted.