• Stars
    star
    117
  • Rank 301,828 (Top 6 %)
  • Language
    JavaScript
  • Created almost 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ”Œ A Developer Tools panel for flagging browser compatibility issues

Colorful Lego bricks

Compat Report

coverage Build Status

A DevTools panel for flagging browser compatibility issues

Overview

This extension creates a Developer Tools panel that provides a basic overview of potential browser compatibility issues, using data from MDN. It's compatible with Mozilla Firefox and Google Chrome.

Screenshot of Compat Report

Installation

Development

Architecture

The panel is a JavaScript application built with Preact.js and Redux.

Some files exist in the dist/ directory, such as the extension manifest, images and the background scripts. In the majority of times, however, you'll be working on the src/ directory, where the Preact components and the key libraries live.

Inside lib/, the main file is StyleSheet.js, a module for parsing and processing stylesheets using PostCSS. When processing a stylesheet, it uses 3 sub-modules to process different types of elements:

  • lib/AtRule.js: processes at-rules
  • lib/Selector.js: processes selectors
  • lib/Declaration.js: processes declarations

Transforms

When processing a declaration, the property will be matched against the list of CSS properties from MDN. This is a trivial comparison โ€“ when we find a property, say transform, we look for a mdn.css.properties.transform object.

But MDN compat data has the concept of sub-features, a variant of an object that introduces different browser support. In the example of transform, this could be 3D transforms.

This is identified by mdn.css.properties.transform.3d in MDN, but matching it with a CSS declaration is more complex than a textual comparison, as we need to look for transform functions (matrix3d, rotate3d, scale3d or translate3d). We need a set of rules that specify how each sub-feature can be identified in a block of CSS.

We do this with transforms (probably not the best name for the concept, but the best I could do). Each transform consists of a JavaScript file that receives a declaration, a rule and a list of MDN compatibility keys (like transform and transform.3d). The latter can be modified by a transform, which can add a new key to the list to signal a new compatibility problem, or remove existing items from the list if the transform believes that the context of the rule/declaration means that a particular key shouldn't be flagged as a compatibility issue.

To see an example, check the transform-3d transform which determines whether a transform function has been used in a declaration, applying the transform.3d sub-property if so.

Installing

  1. Clone the repository

    git clone [email protected]:eduardoboucas/compat-report.git
  2. Install the dependencies using NPM

    npm install
  3. Watch for changes

    npm run watch

Test suite

Unit tests use Jest and live in the test/ directory.

To run the suite:

npm test

Credits

Logo made by Smashicons. Icon made by Coucou.

More Repositories

1

include-media

๐Ÿ“ Simple, elegant and maintainable media queries in Sass
SCSS
2,571
star
2

staticman

๐Ÿ’ช User-generated content for Git-powered websites
JavaScript
2,413
star
3

static-api-generator

๐Ÿ”ง Generate a static JSON API from a tree of directories and files
JavaScript
146
star
4

buildtimes

โœ๏ธ Musings on building (and breaking) websites
JavaScript
88
star
5

popcorn

๐ŸŽฌ Demo of a Jekyll site using Staticman
HTML
85
star
6

include-media-export

๐Ÿ“ An include-media plugin for exporting breakpoints from Sass to JavaScript
JavaScript
72
star
7

inquirer-table-prompt

A table-like prompt for Inquirer
JavaScript
37
star
8

hugo-plus-staticman

โšก๏ธ Demo site using Hugo + Staticman
HTML
25
star
9

jekyll-social

Select what social media platforms to share your Jekyll blog posts on, right from the front matter.
21
star
10

jekyll-dynamic-menu

A Liquid snippet to generate markup for a dynamic navigation menu in Jekyll
HTML
19
star
11

postcss-cssential

๐Ÿšฉ PostCSS plugin to identify annotated blocks of critical CSS and inline them into a page
JavaScript
19
star
12

haiku

๐Ÿš€ Instant Heroku deploys from GitHub branches
JavaScript
16
star
13

include-media-columns

An include-media plugin for generating grid classes based on the BEMIT naming convention
CSS
16
star
14

gitemon

๐Ÿ‘พ Gotta Catch 'Em All!
JavaScript
16
star
15

wp-api-post-groups

A WP-API extension that allows multiple groups of posts with different filters to be obtained in a single request
PHP
15
star
16

eleventy-blog-staticman

A starter repository for a blog web site using the Eleventy static site generator and Staticman.
HTML
10
star
17

grunt-sass-import

A Grunt module for importing Sass partials with (some very basic) notion of source order
JavaScript
10
star
18

staticman-recaptcha

๐Ÿ‘ฎโ€โ™‚๏ธ Demo site using Staticman + reCAPTCHA
CSS
10
star
19

movies-api

๐ŸŽž Demo API using static-api-generator
JavaScript
9
star
20

homebridge-toggle-switch

Toggle switch for Homebridge
JavaScript
6
star
21

include-media-hidden-classes

๐Ÿ“ An include-media plugin to generate classes for hiding elements
CSS
6
star
22

notification-bus

๐ŸšŒ A Node.js library for loading and rendering notifications from a remote API
TypeScript
6
star
23

find-types

๐Ÿ” Find which of your module's dependencies have TypeScript types available
JavaScript
6
star
24

scheduled-netlify-deploys

Trigger Netlify deploys on a schedule
TypeScript
5
star
25

new-function

โœจ A tiny utility for creating a new Netlify Function.
JavaScript
4
star
26

staticman.net

๐Ÿ’ช Staticman website
SCSS
4
star
27

js-promise-queue

๐ŸŽข Runs JavaScript Promises in a queue
JavaScript
3
star
28

denis

A friendly DNS management bot for Slack
JavaScript
3
star
29

todo-api

๐Ÿ“‹ A RESTful API for a to-do list application built with DADI API
JavaScript
2
star
30

homebridge-arlo-basestation

Homebridge plugin for integrating Arlo with HomeKit
JavaScript
2
star
31

ok-to-test-action

2
star
32

next-netlify-starter-2

JavaScript
2
star
33

component-tree-webpack-plugin

A Webpack plugin for creating a simple tree of component dependencies
JavaScript
2
star
34

netlifind

Shell
2
star
35

codepen-scraper

JavaScript
1
star
36

next-netlify-starter

JavaScript
1
star
37

node-github-wrapper

JavaScript
1
star
38

mdn-speedtracker

JavaScript
1
star
39

preact-jsx-chai-match-template

๐Ÿ—œ A method that adds assertions with html-looks-like to Chai for testing Preact components
JavaScript
1
star
40

signally-case

1
star
41

jekyll-discuss-php

(UNMAINTAINED) A commenting system for Jekyll
PHP
1
star