Skip to content

Commit

Permalink
limit css features to browser engines
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Jun 10, 2023
1 parent dff95d2 commit 6eb0e71
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/compat/css_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func UnsupportedCSSFeatures(constraints map[Engine][]int) (unsupported CSSFeatur
continue // This is purely user-specified
}
for engine, version := range constraints {
if engine == ES || engine == Node {
if !engine.IsBrowser() {
// Specifying "--target=es2020" shouldn't affect CSS
continue
}
Expand Down
8 changes: 8 additions & 0 deletions internal/compat/js_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ func (e Engine) String() string {
return ""
}

func (e Engine) IsBrowser() bool {
switch e {
case Chrome, Edge, Firefox, IE, IOS, Opera, Safari:
return true
}
return false
}

type JSFeature uint64

const (
Expand Down
8 changes: 8 additions & 0 deletions scripts/compat-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,14 @@ ${engines.slice().sort().map(x => `\tcase ${upper(x)}:\n\t\treturn "${x}"`).join
\treturn ""
}
func (e Engine) IsBrowser() bool {
\tswitch e {
\tcase Chrome, Edge, Firefox, IE, IOS, Opera, Safari:
\t\treturn true
\t}
\treturn false
}
type JSFeature uint64
const (
Expand Down

0 comments on commit 6eb0e71

Please sign in to comment.