Match browser prefixes
This commit is contained in:
parent
f3de5fc9b6
commit
ce4521b1b3
4 changed files with 14 additions and 14 deletions
|
@ -7,10 +7,10 @@ var GradientParser = {};
|
||||||
GradientParser.parse = (function() {
|
GradientParser.parse = (function() {
|
||||||
|
|
||||||
var tokens = {
|
var tokens = {
|
||||||
linearGradient: /^linear\-gradient/i,
|
linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
|
||||||
repeatingLinearGradient: /^repeating\-linear\-gradient/i,
|
repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
|
||||||
radialGradient: /^radial\-gradient/i,
|
radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
|
||||||
repeatingRadialGradient: /^repeating\-radial\-gradient/i,
|
repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
|
||||||
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
||||||
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
||||||
positionKeywords: /^(left|center|right|top|bottom)/i,
|
positionKeywords: /^(left|center|right|top|bottom)/i,
|
||||||
|
|
|
@ -7,10 +7,10 @@ var GradientParser = {};
|
||||||
GradientParser.parse = (function() {
|
GradientParser.parse = (function() {
|
||||||
|
|
||||||
var tokens = {
|
var tokens = {
|
||||||
linearGradient: /^linear\-gradient/i,
|
linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
|
||||||
repeatingLinearGradient: /^repeating\-linear\-gradient/i,
|
repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
|
||||||
radialGradient: /^radial\-gradient/i,
|
radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
|
||||||
repeatingRadialGradient: /^repeating\-radial\-gradient/i,
|
repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
|
||||||
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
||||||
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
||||||
positionKeywords: /^(left|center|right|top|bottom)/i,
|
positionKeywords: /^(left|center|right|top|bottom)/i,
|
||||||
|
|
|
@ -7,10 +7,10 @@ var GradientParser = {};
|
||||||
GradientParser.parse = (function() {
|
GradientParser.parse = (function() {
|
||||||
|
|
||||||
var tokens = {
|
var tokens = {
|
||||||
linearGradient: /^linear\-gradient/i,
|
linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
|
||||||
repeatingLinearGradient: /^repeating\-linear\-gradient/i,
|
repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
|
||||||
radialGradient: /^radial\-gradient/i,
|
radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
|
||||||
repeatingRadialGradient: /^repeating\-radial\-gradient/i,
|
repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
|
||||||
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
||||||
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
||||||
positionKeywords: /^(left|center|right|top|bottom)/i,
|
positionKeywords: /^(left|center|right|top|bottom)/i,
|
||||||
|
|
|
@ -15,13 +15,13 @@ describe('gradient-parser.js', function () {
|
||||||
describe('error cases', function() {
|
describe('error cases', function() {
|
||||||
it('one more comma in definitions', function() {
|
it('one more comma in definitions', function() {
|
||||||
expect(function() {
|
expect(function() {
|
||||||
gradients.parse('linear-gradient(red, blue),');
|
gradients.parse('-webkit-linear-gradient(red, blue),');
|
||||||
}).to.throwException(/One extra comma/);
|
}).to.throwException(/One extra comma/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('one more comma in colors', function() {
|
it('one more comma in colors', function() {
|
||||||
expect(function() {
|
expect(function() {
|
||||||
gradients.parse('linear-gradient(red, blue,)');
|
gradients.parse('-o-linear-gradient(red, blue,)');
|
||||||
}).to.throwException(/Expected color definition/);
|
}).to.throwException(/Expected color definition/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue