@oscarpalmer/toretto 0.46.0 → 0.47.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.
package/src/style.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import {getString} from '@oscarpalmer/atoms/string';
2
2
  import {setElementValues, updateElementValue} from './internal/element-value';
3
3
  import {getStyleValue} from './internal/get-value';
4
- import {isHTMLOrSVGElement} from './internal/is';
5
4
  import type {TextDirection} from './models';
6
5
 
7
6
  // #region Types
@@ -44,7 +43,7 @@ export function getStyle(
44
43
  property: keyof CSSStyleValues,
45
44
  computed?: boolean,
46
45
  ): string | undefined {
47
- if (isHTMLOrSVGElement(element) && typeof property === 'string') {
46
+ if (element instanceof Element && typeof property === 'string') {
48
47
  return getStyleValue(element, property, computed === true);
49
48
  }
50
49
  }
@@ -64,7 +63,7 @@ export function getStyles<Property extends keyof CSSStyleValues>(
64
63
  ): Record<Property, string | undefined> {
65
64
  const styles = {} as Record<Property, string | undefined>;
66
65
 
67
- if (!(isHTMLOrSVGElement(element) && Array.isArray(properties))) {
66
+ if (!(element instanceof Element && Array.isArray(properties))) {
68
67
  return styles;
69
68
  }
70
69
 
@@ -97,10 +96,10 @@ export function getTextDirection(node: Element | Node): TextDirection;
97
96
  export function getTextDirection(): TextDirection;
98
97
 
99
98
  export function getTextDirection(node?: Element | Node): TextDirection {
100
- let target: HTMLElement | SVGElement;
99
+ let target: HTMLElement;
101
100
 
102
- if (isHTMLOrSVGElement(node)) {
103
- target = node;
101
+ if (node instanceof Element) {
102
+ target = node as HTMLElement;
104
103
  } else {
105
104
  target =
106
105
  node instanceof Node