Comparing version
@@ -0,1 +1,16 @@ | ||
var matchOutsideOfBrackets, pats; | ||
pats = { | ||
attrcc: '[^\\~|^$*\\]]*', | ||
brackets: /(\[[^\]]*\]|\([^\)]*\))/.source, | ||
nobrackets: /[^\[\]\(\)]/.source | ||
}; | ||
matchOutsideOfBrackets = function(pat) { | ||
if (pat instanceof RegExp) { | ||
pat = pat.source; | ||
} | ||
return new RegExp("^(" + pats.brackets + "?" + pats.nobrackets + "*)*" + pat); | ||
}; | ||
module.exports = { | ||
@@ -94,3 +109,164 @@ 'border-radius': { | ||
properties: ['clip-path', 'mask', 'mask-clip', 'mask-composite', 'mask-image', 'mask-origin', 'mask-position', 'mask-repeat', 'mask-size'] | ||
}, | ||
'fontface': { | ||
atrules: ['@font-face'] | ||
}, | ||
'multibackgrounds': { | ||
unimplemented: true | ||
}, | ||
'css-table': { | ||
properties: ['display'], | ||
values: ['table', 'table-cell', 'table-row', 'table-layout'] | ||
}, | ||
'css-gencontent': { | ||
selectors: [':before', ':after'] | ||
}, | ||
'css-fixed': { | ||
properties: ['position'], | ||
values: ['fixed'] | ||
}, | ||
'css-sel2': { | ||
selectors: [matchOutsideOfBrackets(/\*/), matchOutsideOfBrackets(/\>/), matchOutsideOfBrackets(/\+/), matchOutsideOfBrackets(/\./), matchOutsideOfBrackets(/#/), ':first-child', ':link', ':visited', ':active', ':hover', ':focus', ':lang', new RegExp("\\[" + pats.attrcc + "\\]"), new RegExp("\\[" + pats.attrcc + "=" + pats.attrcc + "\\]"), new RegExp("\\[" + pats.attrcc + "\\~=" + pats.attrcc + "\\]"), new RegExp("\\[" + pats.attrcc + "\\|=" + pats.attrcc + "\\]")] | ||
}, | ||
'css-sel3': { | ||
selectors: [new RegExp("\\[" + pats.attrcc + "\\^=" + pats.attrcc + "\\]"), new RegExp("\\[" + pats.attrcc + "\\$=" + pats.attrcc + "\\]"), new RegExp("\\[" + pats.attrcc + "\\*=" + pats.attrcc + "\\]"), ':root', ':nth-child', ':nth-last-child', 'nth-of-type', 'nth-last-of-type', ':last-child', ':first-of-type', ':last-of-type', ':only-child', ':only-of-type', ':empty', ':target', ':enabled', ':disabled', ':checked', ':not', /^[^\[]*~/] | ||
}, | ||
'css-textshadow': { | ||
properties: ['text-shadow'] | ||
}, | ||
'css3-colors': { | ||
properties: [''], | ||
values: ['rgba', 'hsl', 'hsla'] | ||
}, | ||
'css-mediaqueries': { | ||
atrules: ['@media'] | ||
}, | ||
'css-canvas': { | ||
unimplemented: true | ||
}, | ||
'css-reflections': { | ||
properties: ['box-reflect'] | ||
}, | ||
'svg-css': { | ||
unimplemented: true | ||
}, | ||
'css-featurequeries': { | ||
unimplemented: true | ||
}, | ||
'css-opacity': { | ||
unimplemented: true | ||
}, | ||
'text-overflow': { | ||
unimplemented: true | ||
}, | ||
'wordwrap': { | ||
unimplemented: true | ||
}, | ||
'object-fit': { | ||
unimplemented: true | ||
}, | ||
'minmaxwh': { | ||
properties: ['min-width', 'max-width', 'min-height', 'max-height'] | ||
}, | ||
'text-stroke': { | ||
unimplemented: true | ||
}, | ||
'inline-block': { | ||
properties: ['display'], | ||
values: ['inline-block'] | ||
}, | ||
'css-grid': { | ||
unimplemented: true | ||
}, | ||
'rem': { | ||
properties: [''], | ||
values: ['rem'] | ||
}, | ||
'ttf': { | ||
unimplemented: true | ||
}, | ||
'pointer-events': { | ||
unimplemented: true | ||
}, | ||
'css-regions': { | ||
unimplemented: true | ||
}, | ||
'css-counters': { | ||
unimplemented: true | ||
}, | ||
'css-resize': { | ||
unimplemented: true | ||
}, | ||
'css-repeating-gradients': { | ||
unimplemented: true | ||
}, | ||
'getcomputedstyle': { | ||
unimplemented: true | ||
}, | ||
'word-break': { | ||
unimplemented: true | ||
}, | ||
'viewport-units': { | ||
unimplemented: true | ||
}, | ||
'style-scoped': { | ||
unimplemented: true | ||
}, | ||
'outline': { | ||
unimplemented: true | ||
}, | ||
'css3-cursors': { | ||
unimplemented: true | ||
}, | ||
'css-variables': { | ||
unimplemented: true | ||
}, | ||
'css-backgroundblendmode': { | ||
unimplemented: true | ||
}, | ||
'css-mixblendmode': { | ||
unimplemented: true | ||
}, | ||
'will-change': { | ||
unimplemented: true | ||
}, | ||
'css-shapes': { | ||
unimplemented: true | ||
}, | ||
'kerning-pairs-ligatures': { | ||
unimplemented: true | ||
}, | ||
'css-image-orientation': { | ||
unimplemented: true | ||
}, | ||
'css-appearance': { | ||
unimplemented: true | ||
}, | ||
'css-background-offsets': { | ||
unimplemented: true | ||
}, | ||
'css-touch-action': { | ||
unimplemented: true | ||
}, | ||
'css-clip-path': { | ||
unimplemented: true | ||
}, | ||
'font-loading': { | ||
unimplemented: true | ||
}, | ||
'font-unicode-range': { | ||
unimplemented: true | ||
}, | ||
'css-font-stretch': { | ||
unimplemented: true | ||
}, | ||
'font-size-adjust': { | ||
unimplemented: true | ||
}, | ||
'css-media-resolution': { | ||
unimplemented: true | ||
}, | ||
'css-image-set': { | ||
unimplemented: true | ||
} | ||
}; |
@@ -1,2 +0,2 @@ | ||
var Detector, features, matches, _; | ||
var Detector, features, isFoundIn, _; | ||
@@ -7,5 +7,15 @@ _ = require('lodash'); | ||
matches = function(str) { | ||
return function(test) { | ||
return str.indexOf(test) >= 0; | ||
/* | ||
str: string to search in. | ||
searchfor: string or pattern to search for. | ||
*/ | ||
isFoundIn = function(str) { | ||
return function(searchfor) { | ||
if (searchfor instanceof RegExp) { | ||
return searchfor.test(str); | ||
} else { | ||
return (str != null ? str.indexOf(searchfor) : void 0) >= 0; | ||
} | ||
}; | ||
@@ -47,7 +57,7 @@ }; | ||
var _i, _len, _ref1, _ref2, _results1; | ||
_ref2 = ((_ref1 = data.properties) != null ? _ref1 : []).filter(matches(decl.prop)); | ||
_ref2 = ((_ref1 = data.properties) != null ? _ref1 : []).filter(isFoundIn(decl.prop)); | ||
_results1 = []; | ||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { | ||
prop = _ref2[_i]; | ||
if ((data.values == null) || _.find(data.values, matches(decl.value))) { | ||
if ((data.values == null) || _.find(data.values, isFoundIn(decl.value))) { | ||
cb({ | ||
@@ -73,3 +83,3 @@ usage: decl, | ||
data = _ref[feat]; | ||
if (_.find((_ref1 = data.selectors) != null ? _ref1 : [], matches(rule.selector))) { | ||
if (_.find((_ref1 = data.selectors) != null ? _ref1 : [], isFoundIn(rule.selector))) { | ||
cb({ | ||
@@ -76,0 +86,0 @@ usage: rule, |
{ | ||
"name": "doiuse", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Lint CSS for browser support against caniuse database.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
47956
35.03%901
34.88%