Skip to content

Commit 26a6020

Browse files
Remove polyfill.io
Prepare for releasing a hotfix: https://oisaur.com/@renchap/112679062235365025
1 parent cf64cf5 commit 26a6020

File tree

2 files changed

+4
-34
lines changed

2 files changed

+4
-34
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,9 @@ This file is the entry point of Mavo and all of Mavo's components are utilized h
140140
* `attributes` object is an array of all attributes. It is incomplete as more are in separate JS files and are pushed later to this object.
141141

142142
### How Mavo Picks Up `mv-app` Elements
143-
1. Fetches polyfills needed ([polyfill.io](https://polyfill.io/v2/docs/)); syntax-level features cannot be polyfilled.
144-
* Mavo has a list (IntersectionObserver, Symbol) that needs to be polyfilled.
145-
2. Adds/pushes dependencies after the polyfills are loaded.
146-
3. Loads Mavo plugins using `_.Plugins.load()` defined in plugins.js.
147-
4. `_.inited` Promise resolves after page (`$.ready`) and dependencies are ready.
148-
5. `_.init()` gets all elements with an `mv-app` attribute that matches the `$$` selector (using `selectors` object).
143+
1. Loads Mavo plugins using `_.Plugins.load()` defined in plugins.js.
144+
2. `_.inited` Promise resolves after page (`$.ready`) and dependencies are ready.
145+
3. `_.init()` gets all elements with an `mv-app` attribute that matches the `$$` selector (using `selectors` object).
149146
1. Filters array of `mv-app` elements (use `Mavo.get` to see if there’s another mv-app associated with this element).
150147
2. Maps each element to a new Mavo instance & return this array.
151148

src/mavo.js

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -812,22 +812,6 @@ let _ = self.Mavo = $.Class(class Mavo {
812812
$.ready().then(() => _.Plugins.load()),
813813
]
814814

815-
// Only naive tests here (no false positives, but false negatives are ok).
816-
// polyfill.io will do more proper checking
817-
static polyfillsNeeded = {
818-
"blissfuljs": Array.from && document.documentElement.closest && self.URL && "searchParams" in URL.prototype,
819-
"Intl.~locale.en": self.Intl,
820-
"IntersectionObserver": self.IntersectionObserver,
821-
"Symbol": self.Symbol,
822-
"Element.prototype.remove": Element.prototype.remove,
823-
"Element.prototype.before": Element.prototype.before,
824-
"Element.prototype.after": Element.prototype.after,
825-
"Element.prototype.prepend": Element.prototype.prepend,
826-
"Array.prototype.flat": Array.prototype.flat,
827-
"Array.prototype.flatMap": Array.prototype.flatMap,
828-
}
829-
static polyfills = []
830-
831815
static init (container = document) {
832816
let mavos = Array.isArray(arguments[0])? arguments[0] : $$(_.selectors.init, container);
833817

@@ -986,7 +970,7 @@ let _ = self.Mavo = $.Class(class Mavo {
986970
});
987971

988972
// Define symbols
989-
// These are lazy to give the Symbol polyfill a chance to load if needed
973+
// TODO: These should not be lazy anymore?
990974
["toNode", "isProxy", "route", "parent", "property", "mavo", "groupedBy", "as"].forEach(symbol => {
991975
$.lazy(_, symbol, () => Symbol(symbol));
992976
});
@@ -1018,23 +1002,12 @@ s.output = "[property=output], .mv-output";
10181002

10191003
}
10201004

1021-
$.each(_.polyfillsNeeded, (id, supported) => {
1022-
if (!supported) {
1023-
_.polyfills.push(id);
1024-
}
1025-
});
1026-
10271005
_.ready = _.thenAll(_.dependencies);
10281006
_.inited = _.promise();
10291007

10301008
// Init mavo. Async to give other scripts a chance to modify stuff.
10311009
await _.defer();
10321010

1033-
if (_.polyfills.length > 0) {
1034-
var polyfillURL = "https://cdn.polyfill.io/v2/polyfill.min.js?unknown=polyfill&features=" + _.polyfills.map(a => a + "|gated").join(",");
1035-
_.dependencies.push($.include(polyfillURL));
1036-
}
1037-
10381011
await $.ready();
10391012

10401013
/***********************

0 commit comments

Comments
 (0)