@oscarpalmer/toretto 0.30.1 → 0.32.0

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.
Files changed (42) hide show
  1. package/dist/attribute/index.js +5 -5
  2. package/dist/event/delegation.js +21 -28
  3. package/dist/event/index.js +1 -1
  4. package/dist/find/index.js +3 -3
  5. package/dist/find/relative.js +22 -22
  6. package/dist/html/index.js +11 -8
  7. package/dist/html/sanitize.js +29 -14
  8. package/dist/index.js +2 -2
  9. package/dist/internal/attribute.js +5 -5
  10. package/dist/is.js +3 -3
  11. package/dist/style.js +2 -2
  12. package/dist/toretto.full.js +125 -264
  13. package/package.json +6 -6
  14. package/src/attribute/get.ts +4 -12
  15. package/src/attribute/index.ts +5 -5
  16. package/src/attribute/set.ts +13 -13
  17. package/src/data.ts +7 -16
  18. package/src/event/delegation.ts +24 -52
  19. package/src/event/index.ts +1 -7
  20. package/src/find/index.ts +2 -2
  21. package/src/find/relative.ts +43 -49
  22. package/src/html/index.ts +13 -12
  23. package/src/html/sanitize.ts +58 -31
  24. package/src/internal/attribute.ts +9 -9
  25. package/src/internal/element-value.ts +3 -4
  26. package/src/internal/get-value.ts +5 -8
  27. package/src/internal/is.ts +1 -3
  28. package/src/is.ts +4 -4
  29. package/src/models.ts +0 -5
  30. package/src/style.ts +12 -15
  31. package/types/attribute/get.d.ts +3 -3
  32. package/types/attribute/set.d.ts +9 -9
  33. package/types/data.d.ts +4 -5
  34. package/types/event/delegation.d.ts +1 -1
  35. package/types/find/index.d.ts +1 -1
  36. package/types/find/relative.d.ts +8 -2
  37. package/types/internal/attribute.d.ts +7 -7
  38. package/types/internal/element-value.d.ts +2 -3
  39. package/types/internal/get-value.d.ts +2 -3
  40. package/types/internal/is.d.ts +1 -2
  41. package/types/models.d.ts +0 -4
  42. package/types/style.d.ts +7 -7
@@ -1,16 +1,16 @@
1
1
  import { getAttribute, getAttributes } from "./get.js";
2
- import { booleanAttributes, isBadAttribute as isBadAttribute$1, isBooleanAttribute as isBooleanAttribute$1, isEmptyNonBooleanAttribute as isEmptyNonBooleanAttribute$1, isInvalidBooleanAttribute as isInvalidBooleanAttribute$1 } from "../internal/attribute.js";
2
+ import { _isBadAttribute, _isBooleanAttribute, _isEmptyNonBooleanAttribute, _isInvalidBooleanAttribute, booleanAttributes } from "../internal/attribute.js";
3
3
  import { setAttribute, setAttributes, setProperties, setProperty } from "./set.js";
4
4
  function isBadAttribute(first, second) {
5
- return isBadAttribute$1(first, second, true);
5
+ return _isBadAttribute(first, second, true);
6
6
  }
7
7
  function isBooleanAttribute(first) {
8
- return isBooleanAttribute$1(first, true);
8
+ return _isBooleanAttribute(first, true);
9
9
  }
10
10
  function isEmptyNonBooleanAttribute(first, second) {
11
- return isEmptyNonBooleanAttribute$1(first, second, true);
11
+ return _isEmptyNonBooleanAttribute(first, second, true);
12
12
  }
13
13
  function isInvalidBooleanAttribute(first, second) {
14
- return isInvalidBooleanAttribute$1(first, second, true);
14
+ return _isInvalidBooleanAttribute(first, second, true);
15
15
  }
16
16
  export { booleanAttributes, getAttribute, getAttributes, isBadAttribute, isBooleanAttribute, isEmptyNonBooleanAttribute, isInvalidBooleanAttribute, setAttribute, setAttributes, setProperties, setProperty };
@@ -1,37 +1,39 @@
1
1
  import { isEventTarget } from "../internal/is.js";
2
- function addDelegatedHandler(document$1, type, name, passive) {
3
- const count = `${name}${COUNT_SUFFIX}`;
4
- if (document$1[count] != null) {
5
- document$1[count] += 1;
6
- return;
7
- }
8
- document$1[count] = 1;
9
- document$1.addEventListener(type, passive ? HANDLER_PASSIVE : HANDLER_ACTIVE, { passive });
2
+ function addDelegatedHandler(doc, type, name, passive) {
3
+ if (DELEGATED.has(name)) return;
4
+ DELEGATED.add(name);
5
+ doc.addEventListener(type, passive ? HANDLER_PASSIVE : HANDLER_ACTIVE, { passive });
10
6
  }
11
7
  function addDelegatedListener(target, type, name, listener, passive) {
12
8
  target[name] ??= /* @__PURE__ */ new Set();
13
- target[name]?.add(listener);
9
+ target[name].add(listener);
14
10
  addDelegatedHandler(document, type, name, passive);
15
11
  return () => {
16
- removeDelegatedListener(target, type, name, listener, passive);
12
+ removeDelegatedListener(target, name, listener);
17
13
  };
18
14
  }
19
15
  function delegatedEventHandler(event) {
20
16
  const key = `${EVENT_PREFIX}${event.type}${this ? EVENT_SUFFIX_PASSIVE : EVENT_SUFFIX_ACTIVE}`;
21
17
  const items = event.composedPath();
22
18
  const { length } = items;
23
- Object.defineProperty(event, "target", {
24
- configurable: true,
25
- value: items[0]
19
+ let target = items[0];
20
+ Object.defineProperties(event, {
21
+ currentTarget: {
22
+ configurable: true,
23
+ get() {
24
+ return target;
25
+ }
26
+ },
27
+ target: {
28
+ configurable: true,
29
+ value: target
30
+ }
26
31
  });
27
32
  for (let index = 0; index < length; index += 1) {
28
33
  const item = items[index];
29
34
  const listeners = item[key];
30
35
  if (item.disabled || listeners == null) continue;
31
- Object.defineProperty(event, "currentTarget", {
32
- configurable: true,
33
- value: item
34
- });
36
+ target = item;
35
37
  for (const listener of listeners) {
36
38
  listener.call(item, event);
37
39
  if (event.cancelBubble) return;
@@ -41,23 +43,14 @@ function delegatedEventHandler(event) {
41
43
  function getDelegatedName(target, type, options) {
42
44
  if (isEventTarget(target) && EVENT_TYPES.has(type) && !options.capture && !options.once && options.signal == null) return `${EVENT_PREFIX}${type}${options.passive ? EVENT_SUFFIX_PASSIVE : EVENT_SUFFIX_ACTIVE}`;
43
45
  }
44
- function removeDelegatedHandler(document$1, type, name, passive) {
45
- const count = `${name}${COUNT_SUFFIX}`;
46
- document$1[count] -= 1;
47
- if (document$1[count] < 1) {
48
- document$1[count] = void 0;
49
- document$1.removeEventListener(type, passive ? HANDLER_PASSIVE : HANDLER_ACTIVE);
50
- }
51
- }
52
- function removeDelegatedListener(target, type, name, listener, passive) {
46
+ function removeDelegatedListener(target, name, listener) {
53
47
  const handlers = target[name];
54
48
  if (handlers == null || !handlers.has(listener)) return false;
55
49
  handlers.delete(listener);
56
50
  if (handlers.size === 0) target[name] = void 0;
57
- removeDelegatedHandler(document, type, name, passive);
58
51
  return true;
59
52
  }
60
- var COUNT_SUFFIX = ".count";
53
+ var DELEGATED = /* @__PURE__ */ new Set();
61
54
  var EVENT_PREFIX = "@";
62
55
  var EVENT_SUFFIX_ACTIVE = ":active";
63
56
  var EVENT_SUFFIX_PASSIVE = ":passive";
@@ -48,7 +48,7 @@ function off(target, type, listener, options) {
48
48
  if (!isEventTarget(target) || typeof type !== "string" || typeof listener !== "function") return;
49
49
  const extended = createEventOptions(options);
50
50
  const delegated = getDelegatedName(target, type, extended);
51
- if (delegated == null || !removeDelegatedListener(target, type, delegated, listener, extended.passive)) target.removeEventListener(type, listener, extended);
51
+ if (delegated == null || !removeDelegatedListener(target, delegated, listener)) target.removeEventListener(type, listener, extended);
52
52
  }
53
53
  function on(target, type, listener, options) {
54
54
  if (!isEventTarget(target) || typeof type !== "string" || typeof listener !== "function") return noop;
@@ -1,4 +1,4 @@
1
- import { findAncestor, findRelatives } from "./relative.js";
1
+ import { findAncestor, findRelatives, getDistance } from "./relative.js";
2
2
  function findElement(selector, context) {
3
3
  return findElementOrElements(selector, context, true);
4
4
  }
@@ -33,7 +33,7 @@ function findElementOrElementsFromNodes(array, context, contexts) {
33
33
  let element;
34
34
  if (node instanceof Document) element = node.body;
35
35
  else element = node instanceof Element ? node : void 0;
36
- if (element != null && (context == null || contexts.length === 0 || contexts.some((context$1) => context$1 === element || context$1.contains(element))) && !result.includes(element)) result.push(element);
36
+ if (element != null && (context == null || contexts.length === 0 || contexts.some((ctx) => ctx === element || ctx.contains(element))) && !result.includes(element)) result.push(element);
37
37
  }
38
38
  return result;
39
39
  }
@@ -61,4 +61,4 @@ var STYLE_HIDDEN = "hidden";
61
61
  var STYLE_NONE = "none";
62
62
  var SUFFIX_HOVER = ":hover";
63
63
  var TAG_HEAD = "HEAD";
64
- export { findElement as $, findElement, findElements as $$, findElements, findAncestor, findRelatives, getElementUnderPointer };
64
+ export { findElement as $, findElement, findElements as $$, findElements, findAncestor, findRelatives, getDistance, getElementUnderPointer };
@@ -1,11 +1,3 @@
1
- function getDistanceBetweenElements(origin, target) {
2
- if (origin === target || origin.parentElement === target) return 0;
3
- const comparison = origin.compareDocumentPosition(target);
4
- const children = [...origin.parentElement?.children ?? []];
5
- if (children.includes(target)) return Math.abs(children.indexOf(origin) - children.indexOf(target));
6
- const beforeOrInside = !!(comparison & 2 || comparison & 8);
7
- if (beforeOrInside || !!(comparison & 4 || comparison & 16)) return traverse(beforeOrInside ? origin : target, beforeOrInside ? target : origin) ?? -1;
8
- }
9
1
  function findAncestor(origin, selector) {
10
2
  if (!(origin instanceof Element) || selector == null) return null;
11
3
  if (typeof selector === "string") {
@@ -23,17 +15,15 @@ function findAncestor(origin, selector) {
23
15
  }
24
16
  function findRelatives(origin, selector, context) {
25
17
  if (!(origin instanceof Element) || typeof selector !== "string") return [];
26
- if (origin.matches(selector)) return [origin];
27
18
  const elements = [...(context instanceof Document || context instanceof Element ? context : document).querySelectorAll(selector)];
28
19
  const { length } = elements;
29
- if (length === 0) return [];
30
- if (length === 1) return [elements[0]];
20
+ if (length < 2) return elements.filter((element) => element !== origin);
31
21
  const distances = [];
32
22
  let minimum;
33
23
  for (let index = 0; index < length; index += 1) {
34
24
  const element = elements[index];
35
- const distance = getDistanceBetweenElements(origin, element) ?? -1;
36
- if (distance > -1) {
25
+ const distance = getDistance(origin, element);
26
+ if (distance > 0) {
37
27
  if (minimum == null || distance < minimum) minimum = distance;
38
28
  distances.push({
39
29
  distance,
@@ -41,26 +31,36 @@ function findRelatives(origin, selector, context) {
41
31
  });
42
32
  }
43
33
  }
44
- return minimum == null ? [] : distances.filter((found) => found.distance === minimum).map((found) => found.element);
34
+ return distances.filter((found) => found.distance === minimum).map((found) => found.element);
35
+ }
36
+ function getDistance(origin, target) {
37
+ if (origin === target) return 0;
38
+ if (origin.parentElement === target || target.parentElement === origin) return 1;
39
+ if (origin.parentElement != null && origin.parentElement === target.parentElement) {
40
+ const children = [...origin.parentElement.children];
41
+ return Math.abs(children.indexOf(origin) - children.indexOf(target));
42
+ }
43
+ const comparison = origin.compareDocumentPosition(target);
44
+ if (comparison & Node.DOCUMENT_POSITION_DISCONNECTED) return -1;
45
+ const preceding = comparison & Node.DOCUMENT_POSITION_PRECEDING;
46
+ return traverse(preceding ? origin : target, preceding ? target : origin) ?? -1;
45
47
  }
46
48
  function traverse(from, to) {
47
- let index = [...to.children].indexOf(from);
48
- if (index > -1) return index + 1;
49
49
  let current = from;
50
50
  let distance = 0;
51
51
  let parent = from.parentElement;
52
52
  while (parent != null) {
53
53
  if (parent === to) return distance + 1;
54
- const children = [...parent.children ?? []];
55
- if (children.includes(to)) return distance + Math.abs(children.indexOf(current) - children.indexOf(to));
56
- index = children.findIndex((child) => child.contains(to));
54
+ const children = [...parent.children];
55
+ if (to.parentElement === parent) return distance + Math.abs(children.indexOf(current) - children.indexOf(to));
56
+ const index = children.findIndex((child) => child.contains(to));
57
57
  if (index > -1) {
58
- const traversed = traverse(current, children[index]) ?? -1;
59
- return traversed === -1 ? -1 : distance + Math.abs(index - children.indexOf(current)) + traversed;
58
+ const traversed = traverse(current, children[index]);
59
+ return traversed == null || traversed === -1 ? -1 : distance + Math.abs(index - children.indexOf(current)) + traversed;
60
60
  }
61
61
  current = parent;
62
62
  distance += 1;
63
63
  parent = parent.parentElement;
64
64
  }
65
65
  }
66
- export { findAncestor, findRelatives };
66
+ export { findAncestor, findRelatives, getDistance };
@@ -1,10 +1,10 @@
1
1
  import { sanitizeNodes } from "./sanitize.js";
2
2
  import { isPlainObject } from "@oscarpalmer/atoms/is";
3
3
  function createHtml(value) {
4
- const html$1 = getParser().parseFromString(typeof value === "string" ? value : value.innerHTML, HTML_PARSE_TYPE);
5
- html$1.body.normalize();
6
- sanitizeNodes([html$1.body], 0);
7
- return html$1.body.innerHTML;
4
+ const parsed = getParser().parseFromString(getHtml(value), PARSE_TYPE_HTML);
5
+ parsed.body.normalize();
6
+ sanitizeNodes([parsed.body], 0);
7
+ return parsed.body.innerHTML;
8
8
  }
9
9
  function createTemplate(value, options) {
10
10
  const template = document.createElement(TEMPLATE_TAG);
@@ -12,6 +12,9 @@ function createTemplate(value, options) {
12
12
  if (typeof value === "string" && options.cache) templates[value] = template;
13
13
  return template;
14
14
  }
15
+ function getHtml(value) {
16
+ return `${TEMPORARY_ELEMENT}${typeof value === "string" ? value : value.innerHTML}${TEMPORARY_ELEMENT}`;
17
+ }
15
18
  function getNodes(value, options) {
16
19
  if (typeof value !== "string" && !(value instanceof HTMLTemplateElement)) return [];
17
20
  const template = getTemplate(value, options);
@@ -28,12 +31,11 @@ function getParser() {
28
31
  }
29
32
  function getTemplate(value, options) {
30
33
  if (value instanceof HTMLTemplateElement) return createTemplate(value, options);
31
- if (typeof value !== "string" || value.trim().length === 0) return;
34
+ if (value.trim().length === 0) return;
32
35
  let template = templates[value];
33
36
  if (template != null) return template;
34
37
  const element = EXPRESSION_ID.test(value) ? document.querySelector(`#${value}`) : null;
35
- template = element instanceof HTMLTemplateElement ? element : createTemplate(value, options);
36
- return template;
38
+ return createTemplate(element instanceof HTMLTemplateElement ? element : value, options);
37
39
  }
38
40
  var html = ((value, options) => {
39
41
  return getNodes(value, getOptions(options));
@@ -56,8 +58,9 @@ function sanitize(value) {
56
58
  return sanitizeNodes(Array.isArray(value) ? value : [value], 0);
57
59
  }
58
60
  var EXPRESSION_ID = /^[a-z][\w-]*$/i;
59
- var HTML_PARSE_TYPE = "text/html";
61
+ var PARSE_TYPE_HTML = "text/html";
60
62
  var TEMPLATE_TAG = "template";
63
+ var TEMPORARY_ELEMENT = "<toretto-temporary></toretto-temporary>";
61
64
  var parser;
62
65
  var templates = {};
63
66
  export { html, sanitize };
@@ -1,25 +1,24 @@
1
- import { isBadAttribute, isEmptyNonBooleanAttribute, isInvalidBooleanAttribute } from "../internal/attribute.js";
1
+ import { _isBadAttribute, _isEmptyNonBooleanAttribute, _isInvalidBooleanAttribute } from "../internal/attribute.js";
2
+ import { setAttribute } from "../attribute/set.js";
2
3
  function handleElement(element, depth) {
3
- if (isClobbered(element)) {
4
- element.remove();
5
- return true;
6
- }
7
4
  if (depth === 0) {
8
- const scripts = element.querySelectorAll("script");
9
- for (const script of scripts) script.remove();
5
+ const removable = element.querySelectorAll(REMOVE_SELECTOR);
6
+ for (const item of removable) item.remove();
10
7
  }
11
8
  sanitizeAttributes(element, [...element.attributes]);
12
- return false;
13
9
  }
14
- function isClobbered(element) {
15
- return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
10
+ function isClobbered(value) {
11
+ return value instanceof HTMLFormElement && (typeof value.nodeName !== "string" || typeof value.textContent !== "string" || typeof value.removeChild !== "function" || !(value.attributes instanceof NamedNodeMap) || typeof value.removeAttribute !== "function" || typeof value.setAttribute !== "function" || typeof value.namespaceURI !== "string" || typeof value.insertBefore !== "function" || typeof value.hasChildNodes !== "function");
12
+ }
13
+ function removeNode(node) {
14
+ if (typeof node.remove === "function") node.remove();
16
15
  }
17
16
  function sanitizeAttributes(element, attributes) {
18
17
  const { length } = attributes;
19
18
  for (let index = 0; index < length; index += 1) {
20
19
  const { name, value } = attributes[index];
21
- if (isBadAttribute(name, value, false) || isEmptyNonBooleanAttribute(name, value, false)) element.removeAttribute(name);
22
- else if (isInvalidBooleanAttribute(name, value, false)) element.setAttribute(name, "");
20
+ if (_isBadAttribute(name, value, false) || _isEmptyNonBooleanAttribute(name, value, false)) element.removeAttribute(name);
21
+ else if (_isInvalidBooleanAttribute(name, value, false)) setAttribute(element, name, true);
23
22
  }
24
23
  }
25
24
  function sanitizeNodes(nodes, depth) {
@@ -27,14 +26,30 @@ function sanitizeNodes(nodes, depth) {
27
26
  let { length } = nodes;
28
27
  for (let index = 0; index < length; index += 1) {
29
28
  const node = actual[index];
30
- if (node instanceof Element && handleElement(node, depth)) {
29
+ let remove = isClobbered(node);
30
+ if (!remove) switch (node.nodeType) {
31
+ case Node.ELEMENT_NODE:
32
+ handleElement(node, depth);
33
+ break;
34
+ case Node.COMMENT_NODE:
35
+ remove = COMMENT_HARMFUL.test(node.data);
36
+ break;
37
+ case Node.DOCUMENT_TYPE_NODE:
38
+ case Node.PROCESSING_INSTRUCTION_NODE:
39
+ remove = true;
40
+ break;
41
+ }
42
+ if (remove) {
43
+ removeNode(node);
31
44
  actual.splice(index, 1);
32
- length -= 1;
33
45
  index -= 1;
46
+ length -= 1;
34
47
  continue;
35
48
  }
36
49
  if (node.hasChildNodes()) sanitizeNodes([...node.childNodes], depth + 1);
37
50
  }
38
51
  return nodes;
39
52
  }
53
+ var COMMENT_HARMFUL = /<[/\w]/g;
54
+ var REMOVE_SELECTOR = "script, toretto-temporary";
40
55
  export { sanitizeAttributes, sanitizeNodes };
package/dist/index.js CHANGED
@@ -3,10 +3,10 @@ import { isBadAttribute, isBooleanAttribute, isEmptyNonBooleanAttribute, isInval
3
3
  import { isChildNode, isInDocument } from "./is.js";
4
4
  import { getData, setData } from "./data.js";
5
5
  import { dispatch, getPosition, off, on } from "./event/index.js";
6
- import { findAncestor, findRelatives } from "./find/relative.js";
6
+ import { findAncestor, findRelatives, getDistance } from "./find/relative.js";
7
7
  import { $ as findElement, $$ as findElements, getElementUnderPointer } from "./find/index.js";
8
8
  import { getFocusable, getTabbable, isFocusable, isTabbable } from "./focusable.js";
9
9
  import { html, sanitize } from "./html/index.js";
10
10
  import touch_default from "./touch.js";
11
11
  import { getStyle, getStyles, getTextDirection, setStyle, setStyles, toggleStyles } from "./style.js";
12
- export { findElement as $, findElement, findElements as $$, findElements, dispatch, findAncestor, findRelatives, getData, getElementUnderPointer, getFocusable, getPosition, getStyle, getStyles, getTabbable, getTextDirection, html, isBadAttribute, isBooleanAttribute, isChildNode, isEmptyNonBooleanAttribute, isEventTarget, isFocusable, isHTMLOrSVGElement, isInDocument, isInvalidBooleanAttribute, isTabbable, off, on, sanitize, setData, setStyle, setStyles, touch_default as supportsTouch, toggleStyles };
12
+ export { findElement as $, findElement, findElements as $$, findElements, dispatch, findAncestor, findRelatives, getData, getDistance, getElementUnderPointer, getFocusable, getPosition, getStyle, getStyles, getTabbable, getTextDirection, html, isBadAttribute, isBooleanAttribute, isChildNode, isEmptyNonBooleanAttribute, isEventTarget, isFocusable, isHTMLOrSVGElement, isInDocument, isInvalidBooleanAttribute, isTabbable, off, on, sanitize, setData, setStyle, setStyles, touch_default as supportsTouch, toggleStyles };
@@ -34,16 +34,16 @@ function handleAttribute(callback, decode, first, second) {
34
34
  function isAttribute(value) {
35
35
  return value instanceof Attr || isPlainObject(value) && typeof value.name === "string" && typeof value.value === "string";
36
36
  }
37
- function isBadAttribute(first, second, decode) {
37
+ function _isBadAttribute(first, second, decode) {
38
38
  return handleAttribute(badAttributeHandler, decode, first, second);
39
39
  }
40
- function isBooleanAttribute(first, decode) {
40
+ function _isBooleanAttribute(first, decode) {
41
41
  return handleAttribute((name) => booleanAttributesSet.has(name?.toLowerCase()), decode, first, "");
42
42
  }
43
- function isEmptyNonBooleanAttribute(first, second, decode) {
43
+ function _isEmptyNonBooleanAttribute(first, second, decode) {
44
44
  return handleAttribute((name, value) => name != null && value != null && !booleanAttributesSet.has(name) && value.trim().length === 0, decode, first, second);
45
45
  }
46
- function isInvalidBooleanAttribute(first, second, decode) {
46
+ function _isInvalidBooleanAttribute(first, second, decode) {
47
47
  return handleAttribute(booleanAttributeHandler, decode, first, second);
48
48
  }
49
49
  function isProperty(value) {
@@ -115,4 +115,4 @@ const booleanAttributes = Object.freeze([
115
115
  var booleanAttributesSet = new Set(booleanAttributes);
116
116
  var formElement = document.createElement("form");
117
117
  var textArea;
118
- export { booleanAttributes, isBadAttribute, isBooleanAttribute, isEmptyNonBooleanAttribute, isInvalidBooleanAttribute, isProperty, updateValue, updateValues };
118
+ export { _isBadAttribute, _isBooleanAttribute, _isEmptyNonBooleanAttribute, _isInvalidBooleanAttribute, booleanAttributes, isProperty, updateValue, updateValues };
package/dist/is.js CHANGED
@@ -2,10 +2,10 @@ import { isEventTarget, isHTMLOrSVGElement } from "./internal/is.js";
2
2
  function isChildNode(value) {
3
3
  return value instanceof Node && CHILD_NODE_TYPES.has(value.nodeType);
4
4
  }
5
- function isInDocument(node, document) {
5
+ function isInDocument(node, doc) {
6
6
  if (!(node instanceof Node)) return false;
7
- if (!(document instanceof Document)) return node.ownerDocument?.contains(node) ?? true;
8
- return node.ownerDocument == null ? node === document : node.ownerDocument === document && document.contains(node);
7
+ if (!(doc instanceof Document)) return node.ownerDocument?.contains(node) ?? true;
8
+ return node.ownerDocument == null ? node === doc : node.ownerDocument === doc && doc.contains(node);
9
9
  }
10
10
  var CHILD_NODE_TYPES = new Set([
11
11
  Node.ELEMENT_NODE,
package/dist/style.js CHANGED
@@ -55,8 +55,8 @@ function toggleStyles(element, styles) {
55
55
  };
56
56
  }
57
57
  function updateStyleProperty(element, key, value) {
58
- updateElementValue(element, key, value, function(property, value$1) {
59
- this.style[property] = value$1;
58
+ updateElementValue(element, key, value, function(property, style) {
59
+ this.style[property] = style;
60
60
  }, function(property) {
61
61
  this.style[property] = "";
62
62
  }, false);