Skip to content

Commit dfaddef

Browse files
committed
Implement biscuitman-legacy version, supporting IE11 and other 2013 browsers
1 parent ba3faa2 commit dfaddef

26 files changed

+2453
-5731
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ While you have the option to enable or disable some or all of these cookies, not
121121

122122
## Experimental ESM version
123123

124-
ESM version supplied as an alternative packaging format. Long-term it's better to not have two versions, so this may or not become the main version. Consider it an alternate packaging format at this point. [see ESM demo](https://replete.github.io/biscuitman/index-esm.html)
124+
ESM version supplied as an alternative packaging format. Long-term it's better to not have two versions, so this may or not become the main version. Consider it an alternate packaging format at this point. ([ESM demo](https://replete.github.io/biscuitman/index-esm.html))
125125

126126
```html
127127
<!-- Experimental ESM version: -->
@@ -177,7 +177,7 @@ html.bm-show::after {
177177

178178
## Browser Support
179179

180-
Biscuitman is written in modern Javascript and transpiled `swc` to target browsers less than two years old. The included distributables are tested to support the following browsers:
180+
Biscuitman is written in modern Javascript and transpiled with `swc` to target browsers less than two years old. The included distributables are tested to support the following browsers:
181181

182182
- Chrome/Edge/Opera: 85+ (released June 2020)
183183
- Firefox: 98+ (released March 2022)
@@ -186,9 +186,9 @@ Biscuitman is written in modern Javascript and transpiled `swc` to target browse
186186

187187
### \<Dialog\> polyfill
188188

189-
To support older than the browsers above, a polyfill for `<dialog>` is required. Biscuitman checks for this and will load the [dialog polyfill](https://github.com/GoogleChrome/dialog-polyfill) automatically if it is not already loaded, and then correctly bind.
189+
To support older than the browsers above, a polyfill for `<dialog>` is required. Biscuitman checks for this automatically and loads a [polyfill for dialog](https://github.com/GoogleChrome/dialog-polyfill) on-demand (if it is not already loaded), and then correctly binds the UI.
190190

191-
For this to work, you must host `dist/dialog-polyfill.withcss.js` and set the biscuitman config property, `dialogPolyfill`, to the correct URL.
191+
For this to work, you must host `dist/dialog-polyfill.withcss.js` and set the config property `dialogPolyfill` to the correct URL.
192192

193193
This will extend the browser support to:
194194
- Safari (inc iOS) 13.1+ (released March 2020)
@@ -197,19 +197,19 @@ This will extend the browser support to:
197197

198198
If the dialog polyfill is already loaded (`window.dialogPolyfill` exists), the polyfill will not be loaded again. To disable this on-demand functionality altogether, set `dialogPolyfill` property to `false`.
199199

200-
### Extending Browser support
200+
### Legacy Browser Support
201201

202-
You can extend support to the following browsers by including the following script _before_ biscuitman.js:
203-
- Safari 11.1+ (released Jan 2018)
204-
- Safari iOS 11.3+ (released Mar 2018)
205-
- Firefox 55+ (released Aug 2017)
206-
- Chrome 60+ (released Jul 2017)
202+
If you need to support really old browsers, use `biscuitman-legacy.js`, `biscuitman-legacy.min.js` or `biscuitman-legacy.withcss.js` to extend the browser support to:
203+
- Safari 7+ / 6.2+ (released Oct 2013)
204+
- Chrome 30+ (released Oct 2013)
205+
- Firefox 24+ (released Sep 2013)
206+
- Chrome 24+ (released Jan 2013)
207+
- IE 11+ (released Oct 2013)
207208

208-
```html
209-
<script src="//cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=4.8.0&features=String.prototype.replaceAll%2CObject.fromEntries"></script>
210-
```
209+
This legacy version is transpiled to ES5 and includes required polyfills to make itself functional on these ancient browsers. This makes the distributables roughtly double the filesize of the modern versions.
210+
211+
In these extremely old browsers, the functionality is intact and the UI is usable but it may look slightly janky as the browser is missing CSS features like `gap` resulting in missing gaps between buttons.
211212

212-
Obviously a third party hosted polyfill is not good for performance, so in this scenario you'd want to self-host the `replaceAll` and `Object.fromEntries` polyfills. This is the lazy approach, if you really need to support older browsers it would make more sense to rebuild biscuitman with an earlier javascript target (update `package.json` `browserlist` property and rebuild with `npm run build`). If there was enough need for this, I'd consider adding a build target for older browsers and release as `biscuitman.legacy.js`.
213213

214214
## Globals
215215
- `biscuitman` – configuration object, must be `window.biscuitman`
@@ -262,7 +262,8 @@ document.addEventListener('bm:save', ({ detail }) => {
262262

263263
`npm run dev` fires up a browserSync development server on `https://localhost:3000`.
264264

265-
We need `https://` active to be able to delete Secure cookies.
265+
We need `https://` to be able to delete Secure cookies.
266+
266267

267268
### Fix NET::ERR_CERT_AUTHORITY_INVALID error
268269

@@ -273,7 +274,6 @@ To prevent invalid certificate warnings, you can generate a local SSL key with `
273274

274275
Visiting `https://localhost:3000` should now work without warnings.
275276

276-
277277
### Building
278278
`npm run build` - creates project distributes via `run.js`, a custom build script requiring `Node v20`
279279

__tests__/e2e.tests.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ let appVersions = [
66
['biscuitman.mjs'],
77
['biscuitman.min.mjs'],
88
['biscuitman.withcss.mjs'],
9-
['biscuitman.withcss.min.mjs']
9+
['biscuitman.withcss.min.mjs'],
10+
['biscuitman-legacy.js'],
11+
['biscuitman-legacy.min.js'],
12+
['biscuitman-legacy.withcss.js'],
13+
['biscuitman-legacy.withcss.min.js']
1014
]
1115

1216
appVersions.forEach(([filename])=>{

dist/biscuitman.legacy.css renamed to dist/biscuitman-legacy.css

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! biscuitman (legacy).js 0.4.2 */
1+
/*! biscuitman-legacy.js 0.5.0 */
22
.biscuitman {
33
--ui: 0, 0, 0;
44
--tx: #444;
@@ -361,10 +361,10 @@
361361
--height: 1.2em;
362362
--width: 2.3em;
363363
--gap: 2px;
364-
height: var(--height);
365-
width: var(--width);
364+
height: 1.2em;
365+
width: 2.3em;
366366
background-color: rgba(0,0,0, .3);
367-
border-radius: var(--height);
367+
border-radius: 1.2em;
368368
margin-top: -2px;
369369
display: block;
370370
position: absolute;
@@ -378,11 +378,11 @@
378378
.biscuitman label:before {
379379
content: "";
380380
background: #fff;
381-
height: calc(var(--height) - calc(var(--gap) * 2));
382-
width: calc(var(--height) - calc(var(--gap) * 2));
383-
height: var(--height);
384-
width: var(--height);
385-
left: var(--gap);
381+
height: calc(1.2em - calc(2px * 2));
382+
width: calc(1.2em - calc(2px * 2));
383+
height: 1.2em;
384+
width: 1.2em;
385+
left: 2px;
386386
-webkit-transform-origin: center;
387387
transform-origin: center;
388388
border-radius: 100%;

0 commit comments

Comments
 (0)