Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for all CSS features #159

Merged
merged 6 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
217 changes: 209 additions & 8 deletions data/features.js

Large diffs are not rendered by default.

Empty file removed data/features/aac.js
Empty file.
Empty file removed data/features/abortcontroller.js
Empty file.
Empty file removed data/features/ac3-ec3.js
Empty file.
Empty file removed data/features/accelerometer.js
Empty file.
Empty file removed data/features/addeventlistener.js
Empty file.
12 changes: 12 additions & 0 deletions data/features/alternate-stylesheet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* No description available.
*
* See: This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=Alternate+stylesheet
*/

// This feature is only in HTML, so we don't lint it

/**
* @type {import('../features').Feature}
*/
export default {};
Empty file removed data/features/ambient-light.js
Empty file.
Empty file removed data/features/apng.js
Empty file.
Empty file removed data/features/array-find-index.js
Empty file.
Empty file removed data/features/array-find.js
Empty file.
Empty file removed data/features/array-flat.js
Empty file.
Empty file removed data/features/array-includes.js
Empty file.
Empty file removed data/features/arrow-functions.js
Empty file.
Empty file removed data/features/asmjs.js
Empty file.
Empty file removed data/features/async-clipboard.js
Empty file.
Empty file removed data/features/async-functions.js
Empty file.
Empty file removed data/features/atob-btoa.js
Empty file.
Empty file removed data/features/audio-api.js
Empty file.
Empty file removed data/features/audio.js
Empty file.
Empty file removed data/features/audiotracks.js
Empty file.
Empty file removed data/features/autofocus.js
Empty file.
Empty file removed data/features/auxclick.js
Empty file.
Empty file removed data/features/av1.js
Empty file.
Empty file removed data/features/avif.js
Empty file.
15 changes: 15 additions & 0 deletions data/features/background-attachment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Method of defining how a background image is attached to a scrollable element. Values include `scroll` (default), `fixed` and `local`.
*
* See: https://caniuse.com/background-attachment
*/

/**
* @type {import('../features').Feature}
*/
export default {
'background-attachment': [
'fixed',
'local',
],
};
13 changes: 13 additions & 0 deletions data/features/background-clip-text.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Non-standard method of clipping a background image to the foreground text.
*
* See: https://caniuse.com/background-clip-text
*/

/**
* @type {import('../features').Feature}
*/
export default {
'background-clip': 'text',
'-webkit-background-clip': 'text',
};
12 changes: 12 additions & 0 deletions data/features/background-repeat-round-space.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Allows CSS background images to be repeated without clipping.
*
* See: https://caniuse.com/background-repeat-round-space
*/

/**
* @type {import('../features').Feature}
*/
export default {
'background-repeat': ['round', 'space'],
};
Empty file removed data/features/background-sync.js
Empty file.
Empty file removed data/features/battery-status.js
Empty file.
Empty file removed data/features/beacon.js
Empty file.
Empty file removed data/features/beforeafterprint.js
Empty file.
Empty file removed data/features/bigint.js
Empty file.
Empty file removed data/features/blobbuilder.js
Empty file.
Empty file removed data/features/bloburls.js
Empty file.
6 changes: 6 additions & 0 deletions data/features/border-image.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
export default {
'border-image': true,
'border-image-outset': true,
'border-image-repeat': true,
'border-image-slice': true,
'border-image-source': true,
'border-image-width': true,

};
Empty file removed data/features/broadcastchannel.js
Empty file.
Empty file removed data/features/brotli.js
Empty file.
Empty file removed data/features/canvas-blending.js
Empty file.
Empty file removed data/features/canvas-text.js
Empty file.
Empty file removed data/features/canvas.js
Empty file.
12 changes: 12 additions & 0 deletions data/features/ch-unit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Unit representing the width of the character "0" in the current font, of particular use in combination with monospace fonts.
*
* See: https://caniuse.com/ch-unit
*/

/**
* @type {import('../features').Feature}
*/
export default {
'': 'ch',
};
Empty file removed data/features/chacha20-poly1305.js
Empty file.
Empty file removed data/features/channel-messaging.js
Empty file.
Empty file removed data/features/childnode-remove.js
Empty file.
Empty file removed data/features/classlist.js
Empty file.
Empty file.
Empty file removed data/features/clipboard.js
Empty file.
Empty file removed data/features/colr-v1.js
Empty file.
Empty file removed data/features/colr.js
Empty file.
Empty file.
Empty file removed data/features/console-basic.js
Empty file.
Empty file removed data/features/console-time.js
Empty file.
Empty file removed data/features/const.js
Empty file.
Empty file.
Empty file removed data/features/contenteditable.js
Empty file.
Empty file.
Empty file.
Empty file removed data/features/cookie-store-api.js
Empty file.
Empty file removed data/features/cors.js
Empty file.
Empty file removed data/features/createimagebitmap.js
Empty file.
Empty file.
Empty file removed data/features/cryptography.js
Empty file.
4 changes: 3 additions & 1 deletion data/features/css-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ export default {
'animation-play-state': true,
'animation-delay': true,
'animation-fill-mode': true,
'@keyframes': true,
};

// @keyframes isn't checked for, but if you try to use it,
// you'll still get a warning anyway because of the 'animation' property
2 changes: 1 addition & 1 deletion data/features/css-any-link.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { checkSelector } from '../../utils/util.js';

export default checkSelector(':any-link');
export default checkSelector([':any-link', ':-webkit-any-link']);
2 changes: 2 additions & 0 deletions data/features/css-appearance.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export default {
'appearance': true,
'-webkit-appearance': true,
'-moz-appearance': true,
};
2 changes: 1 addition & 1 deletion data/features/css-autofill.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { checkSelector } from '../../utils/util.js';

export default checkSelector(':autofill');
export default checkSelector([':autofill', ':-webkit-autofill']);
2 changes: 1 addition & 1 deletion data/features/css-background-offsets.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import { list } from 'postcss';
export default (rule) => {
if (rule.type !== 'decl') return false;
if (rule.prop !== 'background-position') return false;
return list.space(rule.value).length > 3;
return list.space(rule.value).length > 2;
};
13 changes: 13 additions & 0 deletions data/features/css-boxdecorationbreak.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Controls whether the box's margins, borders, padding, and other decorations wrap the broken edges of the box fragments (when the box is split by a break (page/column/region/line).
*
* See: https://caniuse.com/css-boxdecorationbreak
*/

/**
* @type {import('../features').Feature}
*/
export default {
'box-decoration-break': true,
'-webkit-box-decoration-break': true,
};
12 changes: 12 additions & 0 deletions data/features/css-caret-color.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* The `caret-color` property allows the color to be set of the caret (blinking text insertion pointer) in an editable text area.
*
* See: https://caniuse.com/css-caret-color
*/

/**
* @type {import('../features').Feature}
*/
export default {
'caret-color': true,
};
12 changes: 12 additions & 0 deletions data/features/css-cascade-layers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* The `@layer` at-rule allows authors to explicitly layer their styles in the cascade, before specificity and order of appearance are considered.
*
* See: https://caniuse.com/css-cascade-layers
*/

import { checkAtRule } from '../../utils/util.js';

/**
* @type {import('../features').Feature}
*/
export default checkAtRule('layer');
14 changes: 14 additions & 0 deletions data/features/css-case-insensitive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Including an `i` before the `]` in a CSS attribute selector causes the attribute value to be matched in an ASCII-case-insensitive manner. For example, `[b="xyz" i]` would match both `<a b="xyz">` and `<a b="XYZ">`.
*
* See: https://caniuse.com/css-case-insensitive
*/

/**
* @type {import('../features').Feature}
*/
export default (rule) => {
if (rule.type !== 'rule') { return false; }
if (/\[.*i]/.test(rule.selector)) { return true; }
return false;
};
13 changes: 13 additions & 0 deletions data/features/css-color-adjust.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* The `print-color-adjust` (or `-webkit-print-color-adjust` as prefixed in WebKit/Blink browsers) property is a CSS extension that can be used to force printing of background colors and images.
*
* See: https://caniuse.com/css-color-adjust
*/

/**
* @type {import('../features').Feature}
*/
export default {
'print-color-adjust': true,
'-webkit-print-color-adjust': true,
};
12 changes: 12 additions & 0 deletions data/features/css-color-function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* The CSS `color()` function allows the browser to display colors in any color space, such as the P3 color space which can display colors outside of the default sRGB color space.
*
* See: https://caniuse.com/css-color-function
*/

/**
* @type {import('../features').Feature}
*/
export default {
'': 'color(',
};
2 changes: 1 addition & 1 deletion data/features/css-conic-gradients.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const REGEX = /(^|[^-])conic-gradient/;
const REGEX = /(^|[^-])(repeating-)?conic-gradient/;

export default {
'background': REGEX,
Expand Down
2 changes: 1 addition & 1 deletion data/features/css-container-queries-style.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { checkAtRule } from '../../utils/util.js';

export default checkAtRule(['container']);
export default checkAtRule('container', 'style(');
12 changes: 12 additions & 0 deletions data/features/css-container-queries.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Size queries in Container Queries provide a way to query the size of a container, and conditionally apply CSS to the content of that container.
*
* See: https://caniuse.com/css-container-queries
*/

import { checkAtRule } from '../../utils/util.js';

/**
* @type {import('../features').Feature}
*/
export default checkAtRule('container');
12 changes: 12 additions & 0 deletions data/features/css-containment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* The CSS `contain` property lets developers limit the scope of the browser's styles, layout and paint work for faster and more efficient rendering.
*
* See: https://caniuse.com/css-containment
*/

/**
* @type {import('../features').Feature}
*/
export default {
'contain': true,
};
12 changes: 12 additions & 0 deletions data/features/css-content-visibility.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Provides control over when elements are rendered, so rendering can be skipped for elements not yet in the user's viewport.
*
* See: https://caniuse.com/css-content-visibility
*/

/**
* @type {import('../features').Feature}
*/
export default {
'content-visibility': true,
};
1 change: 1 addition & 0 deletions data/features/css-counters.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
'counter-reset': true,
'counter-increment': true,
'': 'counter(',
};
12 changes: 12 additions & 0 deletions data/features/css-crisp-edges.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Scales images with an algorithm that preserves edges and contrast, without smoothing colors or introducing blur. This is intended for images such as pixel art. Official values that accomplish this for the `image-rendering` property are `crisp-edges` and `pixelated`.
*
* See: https://caniuse.com/css-crisp-edges
*/

/**
* @type {import('../features').Feature}
*/
export default {
'image-rendering': ['crisp-edges', 'pixelated'],
};
15 changes: 15 additions & 0 deletions data/features/css-cross-fade.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Image function to create a "crossfade" between images. This allows one image to transition (fade) into another based on a percentage value.
*
* See: https://caniuse.com/css-cross-fade
*/

/**
* @type {import('../features').Feature}
*/
export default {
'': [
'cross-fade(',
'-webkit-cross-fade(',
],
};
12 changes: 12 additions & 0 deletions data/features/css-default-pseudo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* The `:default` pseudo-class matches checkboxes and radio buttons which are checked by default, `<option>`s with the `selected` attribute, and the default submit button (if any) of a form.
*
* See: https://caniuse.com/css-default-pseudo
*/

import { checkSelector } from '../../utils/util.js';

/**
* @type {import('../features').Feature}
*/
export default checkSelector(':default');
12 changes: 12 additions & 0 deletions data/features/css-descendant-gtgt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* An explicit, non-whitespace spelling of the descendant combinator. `A >> B` is equivalent to `A B`.
*
* See: https://caniuse.com/css-descendant-gtgt
*/

import { checkSelector } from '../../utils/util.js';

/**
* @type {import('../features').Feature}
*/
export default checkSelector('>>');
12 changes: 12 additions & 0 deletions data/features/css-deviceadaptation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Method of overriding the size of viewport in web page using the `@viewport` rule, replacing Apple's own popular `<meta>` viewport implementation. Includes the `extend-to-zoom` width value.
*
* See: https://caniuse.com/css-deviceadaptation
*/

import { checkAtRule } from '../../utils/util.js';

/**
* @type {import('../features').Feature}
*/
export default checkAtRule('viewport');
12 changes: 12 additions & 0 deletions data/features/css-dir-pseudo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Matches elements based on their directionality. `:dir(ltr)` matches elements which are Left-to-Right. `:dir(rtl)` matches elements which are Right-to-Left.
*
* See: https://caniuse.com/css-dir-pseudo
*/

import { checkSelector } from '../../utils/util.js';

/**
* @type {import('../features').Feature}
*/
export default checkSelector(':dir(');
12 changes: 12 additions & 0 deletions data/features/css-display-contents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* `display: contents` causes an element's children to appear as if they were direct children of the element's parent, ignoring the element itself. This can be useful when a wrapper element should be ignored when using CSS grid or similar layout techniques.
*
* See: https://caniuse.com/css-display-contents
*/

/**
* @type {import('../features').Feature}
*/
export default {
'display': 'contents',
};
12 changes: 12 additions & 0 deletions data/features/css-element-function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* This function renders a live image generated from an arbitrary HTML element
*
* See: https://caniuse.com/css-element-function
*/

/**
* @type {import('../features').Feature}
*/
export default {
'': 'element(',
};
13 changes: 13 additions & 0 deletions data/features/css-exclusions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Exclusions defines how inline content flows around elements. It extends the content wrapping ability of floats to any block-level element.
*
* See: https://caniuse.com/css-exclusions
*/

/**
* @type {import('../features').Feature}
*/
export default {
'wrap-flow': true,
'-ms-wrap-flow': true,
};
12 changes: 12 additions & 0 deletions data/features/css-file-selector-button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* No description available.
*
* See: This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=::file-selector-button+CSS+pseudo-element
*/

import { checkSelector } from '../../utils/util.js';

/**
* @type {import('../features').Feature}
*/
export default checkSelector(':file-selector-button');
12 changes: 12 additions & 0 deletions data/features/css-filter-function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* This function filters a CSS input image with a set of filter functions (like blur, grayscale or hue)
*
* See: https://caniuse.com/css-filter-function
*/

/**
* @type {import('../features').Feature}
*/
export default {
'': 'filter(',
};
Loading