@@ -165,26 +165,27 @@ CodeMirror.defineMode("css-base", function(config, parserConfig) {
165165 if ( type == "variable-definition" ) state . stack . push ( "propertyValue" ) ;
166166 return "variable-2" ;
167167 } else if ( style == "property" ) {
168- if ( context == "propertyValue" ) {
169- if ( valueKeywords [ stream . current ( ) ] ) {
168+ var word = stream . current ( ) . toLowerCase ( ) ;
169+ if ( context == "propertyValue" ) {
170+ if ( valueKeywords . hasOwnProperty ( word ) ) {
170171 style = "string-2" ;
171- } else if ( colorKeywords [ stream . current ( ) ] ) {
172+ } else if ( colorKeywords . hasOwnProperty ( word ) ) {
172173 style = "keyword" ;
173174 } else {
174175 style = "variable-2" ;
175176 }
176177 } else if ( context == "rule" ) {
177- if ( ! propertyKeywords [ stream . current ( ) ] ) {
178+ if ( ! propertyKeywords . hasOwnProperty ( word ) ) {
178179 style += " error" ;
179180 }
180181 } else if ( context == "block" ) {
181182 // if a value is present in both property, value, or color, the order
182183 // of preference is property -> color -> value
183- if ( propertyKeywords [ stream . current ( ) ] ) {
184+ if ( propertyKeywords . hasOwnProperty ( word ) ) {
184185 style = "property" ;
185- } else if ( colorKeywords [ stream . current ( ) ] ) {
186+ } else if ( colorKeywords . hasOwnProperty ( word ) ) {
186187 style = "keyword" ;
187- } else if ( valueKeywords [ stream . current ( ) ] ) {
188+ } else if ( valueKeywords . hasOwnProperty ( word ) ) {
188189 style = "string-2" ;
189190 } else {
190191 style = "tag" ;
@@ -194,38 +195,36 @@ CodeMirror.defineMode("css-base", function(config, parserConfig) {
194195 } else if ( context == "@media" ) {
195196 if ( atMediaTypes [ stream . current ( ) ] ) {
196197 style = "attribute" ; // Known attribute
197- } else if ( / ^ ( o n l y | n o t ) $ / i . test ( stream . current ( ) ) ) {
198+ } else if ( / ^ ( o n l y | n o t ) $ / . test ( word ) ) {
198199 style = "keyword" ;
199- } else if ( stream . current ( ) . toLowerCase ( ) == "and" ) {
200+ } else if ( word == "and" ) {
200201 style = "error" ; // "and" is only allowed in @mediaType
201- } else if ( atMediaFeatures [ stream . current ( ) ] ) {
202+ } else if ( atMediaFeatures . hasOwnProperty ( word ) ) {
202203 style = "error" ; // Known property, should be in @mediaType(
203204 } else {
204205 // Unknown, expecting keyword or attribute, assuming attribute
205206 style = "attribute error" ;
206207 }
207208 } else if ( context == "@mediaType" ) {
208- if ( atMediaTypes [ stream . current ( ) ] ) {
209+ if ( atMediaTypes . hasOwnProperty ( word ) ) {
209210 style = "attribute" ;
210- } else if ( stream . current ( ) . toLowerCase ( ) == "and" ) {
211+ } else if ( word == "and" ) {
211212 style = "operator" ;
212- } else if ( / ^ ( o n l y | n o t ) $ / i . test ( stream . current ( ) ) ) {
213+ } else if ( / ^ ( o n l y | n o t ) $ / . test ( word ) ) {
213214 style = "error" ; // Only allowed in @media
214- } else if ( atMediaFeatures [ stream . current ( ) ] ) {
215- style = "error" ; // Known property, should be in parentheses
216215 } else {
217216 // Unknown attribute or property, but expecting property (preceded
218217 // by "and"). Should be in parentheses
219218 style = "error" ;
220219 }
221220 } else if ( context == "@mediaType(" ) {
222- if ( propertyKeywords [ stream . current ( ) ] ) {
221+ if ( propertyKeywords . hasOwnProperty ( word ) ) {
223222 // do nothing, remains "property"
224- } else if ( atMediaTypes [ stream . current ( ) ] ) {
223+ } else if ( atMediaTypes . hasOwnProperty ( word ) ) {
225224 style = "error" ; // Known property, should be in parentheses
226- } else if ( stream . current ( ) . toLowerCase ( ) == "and" ) {
225+ } else if ( word == "and" ) {
227226 style = "operator" ;
228- } else if ( / ^ ( o n l y | n o t ) $ / i . test ( stream . current ( ) ) ) {
227+ } else if ( / ^ ( o n l y | n o t ) $ / . test ( word ) ) {
229228 style = "error" ; // Only allowed in @media
230229 } else {
231230 style += " error" ;
0 commit comments