소스 검색

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



불러오는 중...
취소
저장