Quellcode durchsuchen

Add directionality fallback

Refer to the element's direction when run in non-browser contexts.
master
TheoryOfNekomata vor 1 Jahr
Ursprung
Commit
8e94d6057a
1 geänderte Dateien mit 8 neuen und 7 gelöschten Zeilen
  1. +8
    -7
      src/index.ts

+ 8
- 7
src/index.ts Datei anzeigen

@@ -666,16 +666,17 @@ const getInputTextualFieldValue = (
inputEl: HTMLInputTextualElement,
options = {} as GetInputTextualFieldValueOptions,
) => {
if (
options.includeDirectionality
&& typeof window !== 'undefined'
&& typeof window.getComputedStyle === 'function'
&& typeof (inputEl.dirName as unknown) === 'string'
) {
if (options.includeDirectionality) {
return new TextualValueString(
inputEl.value,
inputEl.dirName,
window.getComputedStyle(inputEl).direction || 'ltr',
(
typeof window !== 'undefined'
&& typeof window.getComputedStyle === 'function'
&& typeof (inputEl.dirName as unknown) === 'string'
? window.getComputedStyle(inputEl).direction || 'ltr'
: inputEl.dir
),
);
}



Laden…
Abbrechen
Speichern