@shgysk8zer0/polyfills 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,7 @@ function getAllCookies() {
28
28
  domain: undefined,
29
29
  sameSite: undefined,
30
30
  secure: undefined,
31
+ partitioned: false,
31
32
  };
32
33
  });
33
34
  }
@@ -40,11 +41,11 @@ function defaultParams({
40
41
  path = '/',
41
42
  expires = null,
42
43
  maxAge = null,
43
- sameSite = 'strict',
44
+ sameSite = 'lax',
44
45
  secure = false,
45
- httpOnly = false,
46
+ partitioned = false,
46
47
  }) {
47
- return { name, value, domain, path, expires, maxAge, sameSite, secure, httpOnly };
48
+ return { name, value, domain, path, expires, maxAge, sameSite, secure, partitioned };
48
49
  }
49
50
 
50
51
  function getter({ name = null, value = null } = {}) {
@@ -75,14 +76,14 @@ function setter({
75
76
  expires = null,
76
77
  maxAge = null,
77
78
  path = '/',
78
- sameSite = 'strict',
79
+ sameSite = 'lax',
79
80
  domain = null,
80
81
  secure = false,
81
- httpOnly = false,
82
+ partitioned = false,
82
83
  }) {
83
84
  if (Number.isInteger(maxAge)) {
84
85
  setter({
85
- name, value, expires: Date.now() + maxAge, path, sameSite, domain, secure, httpOnly,
86
+ name, value, expires: Date.now() + maxAge, path, sameSite, domain, secure, partitioned,
86
87
  });
87
88
  } else {
88
89
  let cookie = `${encodeURIComponent(name)}=`;
@@ -113,11 +114,8 @@ function setter({
113
114
  cookie += ';secure';
114
115
  }
115
116
 
116
- /**
117
- * Does not work in any browser, but set regardless
118
- */
119
- if (httpOnly === true) {
120
- cookie += ';httponly';
117
+ if (partitioned === true) {
118
+ cookie += ';partitioned';
121
119
  }
122
120
 
123
121
  document.cookie = cookie;
@@ -173,7 +171,7 @@ export class CookieStore extends EventTarget {
173
171
  }
174
172
 
175
173
  async set(...args) {
176
- if (args.length === 1 && typeof args[0].name === 'string') {
174
+ if (args.length === 1 && typeof args[0] === 'object' && typeof args[0].name === 'string') {
177
175
  const cookie = defaultParams(args[0]);
178
176
  setter(cookie);
179
177
  const event = new Event('change');
@@ -191,7 +189,7 @@ export class CookieStore extends EventTarget {
191
189
  async delete(args = {}) {
192
190
  if (typeof args === 'string') {
193
191
  this.delete({ name: args });
194
- } else if (typeof args.name === 'string') {
192
+ } else if (typeof args === 'object' && typeof args.name === 'string') {
195
193
  const cookies = await this.getAll(args);
196
194
 
197
195
  if (cookies.length !== 0) {
@@ -204,7 +202,7 @@ export class CookieStore extends EventTarget {
204
202
  cookie.domain = args.domain || null;
205
203
  cookie.secure = args.secure || null;
206
204
  delete cookie.value;
207
- cookie.sameSite = args.sameSite || 'strict';
205
+ cookie.sameSite = args.sameSite || 'lax';
208
206
 
209
207
  event.deleted[i] = cookie;
210
208
  setter({...cookie, value: null, expires: 1 });
package/element.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { aria } from './aom.js';
2
- import { overwriteMethod } from './utils.js';
2
+ import { overwriteMethod, polyfillGetterSetter } from './utils.js';
3
3
  import { SanitizerConfig as defaultConfig } from './assets/SanitizerConfigW3C.js';
4
4
  import { setHTML as safeSetHTML, convertToSanitizerConfig } from './assets/sanitizerUtils.js';
5
5
 
@@ -191,3 +191,25 @@ if (! (HTMLFormElement.prototype.requestSubmit instanceof Function)) {
191
191
  }
192
192
  };
193
193
  }
194
+
195
+ if (! ('loading' in HTMLIFrameElement.prototype)) {
196
+ polyfillGetterSetter(HTMLIFrameElement.prototype, 'loading', {
197
+ get: function() {
198
+ return this.getAttribute('loading') || 'auto';
199
+ },
200
+ set: function(val) {
201
+ this.setAttribute('loading', val);
202
+ }
203
+ });
204
+ }
205
+
206
+ if (! ('credentialless' in HTMLIFrameElement.prototype)) {
207
+ polyfillGetterSetter(HTMLIFrameElement.prototype, 'credentialless', {
208
+ get: function() {
209
+ return this.hasAttribute('credentialless');
210
+ },
211
+ set: function(val) {
212
+ this.toggleAttribute('credentialless', val);
213
+ }
214
+ });
215
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgysk8zer0/polyfills",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "A collection of JavaScript polyfills",