ソースを参照

Add directionality fallback

Refer to the element's direction when run in non-browser contexts.
master
コミット
8e94d6057a
1個のファイルの変更8行の追加7行の削除
  1. +8
    -7
      src/index.ts

+ 8
- 7
src/index.ts ファイルの表示

@@ -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
),
);
}



読み込み中…
キャンセル
保存