Skip to content

Commit

Permalink
browser: Update browser checks for replaceAll
Browse files Browse the repository at this point in the history
- Switch caniuse DB URL to 'main'
- Add replaceAll check (even though it isn't in caniusedb
- Manually bump up minimum browser versions
- Update browser support data from script
  • Loading branch information
garrett authored and martinpitt committed Apr 16, 2021
1 parent 4e3ebf3 commit ea70505
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions _data/browser_support.yml
Expand Up @@ -49,6 +49,10 @@ rules:
req:
- supports
- window.CSS
replaceAll:
req:
- replaceAll
- String.prototype
flexbox:
css:
- display
Expand Down
5 changes: 4 additions & 1 deletion _data/browsers.yml
@@ -1,17 +1,20 @@
- firefox:
vendor: Mozilla
name: Firefox
version: 77

- chrome:
vendor: Google
name: Chrome
version: 85

- edge:
vendor: Microsoft
name: Edge
version: 85

- safari:
vendor: Apple
os: iOS
name: Safari
version: 10.3
version: 13.4
13 changes: 10 additions & 3 deletions _scripts/update-browser-data.rb
Expand Up @@ -47,14 +47,19 @@
#promise-finally:
#req: [finally, Promise.prototype]
## `replaceAll` isn't in the caniuse compiled database at the moment (oversight)
## Adding it here strictly for the live in-browser JavaScript check (as a passthrough)
replaceAll:
req: [replaceAll, String.prototype]
flexbox:
css: [display, flex]
css-grid:
css: [display, grid]
")

caniuse_db = "https://raw.githubusercontent.com/Fyrd/caniuse/master/data.json"
caniuse_db = "https://raw.githubusercontent.com/Fyrd/caniuse/main/data.json"
support_file = File.expand_path "#{__dir__}/../_data/" + "browser_support.yml"

puts "Downloading caniuse database..."
Expand All @@ -69,8 +74,10 @@
terminator = 999999

supports.each do |support, vals|
#puts support[0]
data[support]["stats"].each do |browser, version|
# First check to see if the support data is in the caniuse DB.
# It really should be, but sometimes it's missing something.
# Regardless, it needs to be passed through still, for the live JS browser check.
data[support] && data[support]["stats"].each do |browser, version|
# Edge _almost_ supports @supports API; close enough for us
if (support == "css-supports-api")
low_version = version.reject {|k,v| v == "n"}.keys.first
Expand Down

0 comments on commit ea70505

Please sign in to comment.