Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Microsoft uses unprefixed gradients

  • Loading branch information...
commit 80fe13531ec5c66a7e69a12b56a597d303107ae5 1 parent 43cee88
@mattiacci mattiacci authored Michael Mattiacci committed
Showing with 8 additions and 21 deletions.
  1. +3 −8 src/rules/gradients.js
  2. +5 −13 tests/rules/gradients.js
View
11 src/rules/gradients.js
@@ -20,14 +20,13 @@ CSSLint.addRule({
moz: 0,
webkit: 0,
oldWebkit: 0,
- ms: 0,
o: 0
};
});
parser.addListener("property", function(event){
- if (/\-(moz|ms|o|webkit)(?:\-(?:linear|radial))\-gradient/i.test(event.value)){
+ if (/\-(moz|o|webkit)(?:\-(?:linear|radial))\-gradient/i.test(event.value)){
gradients[RegExp.$1] = 1;
} else if (/\-webkit\-gradient/i.test(event.value)){
gradients.oldWebkit = 1;
@@ -50,15 +49,11 @@ CSSLint.addRule({
missing.push("Old Webkit (Safari 4+, Chrome)");
}
- if (!gradients.ms){
- missing.push("Internet Explorer 10+");
- }
-
if (!gradients.o){
missing.push("Opera 11.1+");
}
- if (missing.length && missing.length < 5){
+ if (missing.length && missing.length < 4){
reporter.report("Missing vendor-prefixed CSS gradients for " + missing.join(", ") + ".", event.selectors[0].line, event.selectors[0].col, rule);
}
@@ -66,4 +61,4 @@ CSSLint.addRule({
}
-});
+});
View
18 tests/rules/gradients.js
@@ -10,7 +10,6 @@ background: -moz-linear-gradient(top, #1e5799 , #2989d8 , #207cca , #7db9e8 );
background: -webkit-gradient(linear, left top, left bottom, color-stop(,#1e5799), color-stop(,#2989d8), color-stop(,#207cca), color-stop(10,#7db9e8));
background: -webkit-linear-gradient(top, #1e5799 ,#2989d8 ,#207cca ,#7db9e8 );
background: -o-linear-gradient(top, #1e5799 ,#2989d8 ,#207cca ,#7db9e8 );
-background: -ms-linear-gradient(top, #1e5799 ,#2989d8 ,#207cca ,#7db9e8 );
*/
@@ -20,39 +19,32 @@ background: -ms-linear-gradient(top, #1e5799 ,#2989d8 ,#207cca ,#7db9e8 );
var result = CSSLint.verify(".foo { background: -moz-linear-gradient(top, #1e5799 , #2989d8 , #207cca , #7db9e8 ); }", {"gradients": 1 });
Assert.areEqual(1, result.messages.length);
Assert.areEqual("warning", result.messages[0].type);
- Assert.areEqual("Missing vendor-prefixed CSS gradients for Webkit (Safari 5+, Chrome), Old Webkit (Safari 4+, Chrome), Internet Explorer 10+, Opera 11.1+.", result.messages[0].message);
+ Assert.areEqual("Missing vendor-prefixed CSS gradients for Webkit (Safari 5+, Chrome), Old Webkit (Safari 4+, Chrome), Opera 11.1+.", result.messages[0].message);
},
"Only using Opera gradients should result in a warning": function(){
var result = CSSLint.verify(".foo { background: -o-linear-gradient(top, #1e5799 , #2989d8 , #207cca , #7db9e8 ); }", {"gradients": 1 });
Assert.areEqual(1, result.messages.length);
Assert.areEqual("warning", result.messages[0].type);
- Assert.areEqual("Missing vendor-prefixed CSS gradients for Firefox 3.6+, Webkit (Safari 5+, Chrome), Old Webkit (Safari 4+, Chrome), Internet Explorer 10+.", result.messages[0].message);
- },
-
- "Only using IE gradients should result in a warning": function(){
- var result = CSSLint.verify(".foo { background: -ms-linear-gradient(top, #1e5799 , #2989d8 , #207cca , #7db9e8 ); }", {"gradients": 1 });
- Assert.areEqual(1, result.messages.length);
- Assert.areEqual("warning", result.messages[0].type);
- Assert.areEqual("Missing vendor-prefixed CSS gradients for Firefox 3.6+, Webkit (Safari 5+, Chrome), Old Webkit (Safari 4+, Chrome), Opera 11.1+.", result.messages[0].message);
+ Assert.areEqual("Missing vendor-prefixed CSS gradients for Firefox 3.6+, Webkit (Safari 5+, Chrome), Old Webkit (Safari 4+, Chrome).", result.messages[0].message);
},
"Only using WebKit gradients should result in a warning": function(){
var result = CSSLint.verify(".foo { background: -webkit-linear-gradient(top, #1e5799 , #2989d8 , #207cca , #7db9e8 ); }", {"gradients": 1 });
Assert.areEqual(1, result.messages.length);
Assert.areEqual("warning", result.messages[0].type);
- Assert.areEqual("Missing vendor-prefixed CSS gradients for Firefox 3.6+, Old Webkit (Safari 4+, Chrome), Internet Explorer 10+, Opera 11.1+.", result.messages[0].message);
+ Assert.areEqual("Missing vendor-prefixed CSS gradients for Firefox 3.6+, Old Webkit (Safari 4+, Chrome), Opera 11.1+.", result.messages[0].message);
},
"Only using old WebKit gradients should result in a warning": function(){
var result = CSSLint.verify(".foo { background: -webkit-gradient(linear, left top, left bottom, color-stop(10%,#1e5799), color-stop(20%,#2989d8), color-stop(30%,#207cca), color-stop(100%,#7db9e8)); }", {"gradients": 1 });
Assert.areEqual(1, result.messages.length);
Assert.areEqual("warning", result.messages[0].type);
- Assert.areEqual("Missing vendor-prefixed CSS gradients for Firefox 3.6+, Webkit (Safari 5+, Chrome), Internet Explorer 10+, Opera 11.1+.", result.messages[0].message);
+ Assert.areEqual("Missing vendor-prefixed CSS gradients for Firefox 3.6+, Webkit (Safari 5+, Chrome), Opera 11.1+.", result.messages[0].message);
},
"Using all vendor-prefixed gradients should not result in a warning": function(){
- var result = CSSLint.verify("div.box {\n background: -moz-linear-gradient(top, #1e5799 0%, #7db9e8 100%);\n background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color- stop(100%,#7db9e8));\n background: -webkit-linear-gradient(top, #1e5799 0%,#7db9e8 100%);\n background: -o-linear-gradient(top, #1e5799 0%,#7db9e8 100%);\n background: -ms-linear-gradient(top, #1e5799 0%,#7db9e8 100%); \n}", { "gradients": 1 });
+ var result = CSSLint.verify("div.box {\n background: -moz-linear-gradient(top, #1e5799 0%, #7db9e8 100%);\n background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color- stop(100%,#7db9e8));\n background: -webkit-linear-gradient(top, #1e5799 0%,#7db9e8 100%);\n background: -o-linear-gradient(top, #1e5799 0%,#7db9e8 100%);\n}", { "gradients": 1 });
Assert.areEqual(0, result.messages.length);
}
}));
Please sign in to comment.
Something went wrong with that request. Please try again.