diff --git a/addon/hint/css-hint.js b/addon/hint/css-hint.js index 980d1197e5..c0f2a7f56f 100644 --- a/addon/hint/css-hint.js +++ b/addon/hint/css-hint.js @@ -30,7 +30,7 @@ return {list: ["!important"], from: CodeMirror.Pos(cur.line, token.start), to: CodeMirror.Pos(cur.line, token.end)}; - var start = token.start, end = cur.ch, word = token.string.slice(0, end - start); + var start = token.start, end = cur.ch, word = token.string.slice(0, end - start).toLowerCase(); if (/[^\w$_-]/.test(word)) { word = ""; start = end = cur.ch; } @@ -41,7 +41,7 @@ function add(keywords) { for (var name in keywords) if (!word || name.lastIndexOf(word, 0) == 0) - result.push(name); + result.push(keywords[name] === 1 ? name : keywords[name]); } var st = inner.state.state; diff --git a/mode/css/css.js b/mode/css/css.js index 880b58ef7a..03d5b5c963 100644 --- a/mode/css/css.js +++ b/mode/css/css.js @@ -419,7 +419,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { function keySet(array) { var keys = {}; for (var i = 0; i < array.length; ++i) { - keys[array[i].toLowerCase()] = true; + keys[array[i].toLowerCase()] = array[i]; } return keys; } diff --git a/mode/css/test.js b/mode/css/test.js index 64352d74fc..8b3717136a 100644 --- a/mode/css/test.js +++ b/mode/css/test.js @@ -213,5 +213,11 @@ "[def @font-face] [comment /* foo */] {", " [property src]: [variable&callee url]([string x]);", " [property font-family]: [variable One];", - "}") + "}"); + + MT("property-with-uPpeRCaSe", + "[tag p] { [property cOlOr]:[keyword red]; }"); + + MT("keyword-with-uPpeRCaSe", + "[tag p] { [property color]:[keyword oRanGe]; }"); })();