File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,12 @@ export function redrawCaretAndPreeditUnderline() {
3838 }
3939}
4040
41- const resizeObserver = new ResizeObserver ( redrawCaretAndPreeditUnderline )
41+ const resizeObserver = ( ( ) => {
42+ if ( globalThis . ResizeObserver ) {
43+ return new ResizeObserver ( redrawCaretAndPreeditUnderline )
44+ }
45+ return null // webworker
46+ } ) ( )
4247
4348export function focus ( ) {
4449 if ( ! isInputElement ( document . activeElement ) ) {
@@ -62,7 +67,7 @@ export function focus() {
6267 showKeyboard ( )
6368 resetStacks ( input . value )
6469 }
65- resizeObserver . observe ( input )
70+ resizeObserver ? .observe ( input )
6671 input . addEventListener ( 'mousedown' , resetInput )
6772 originalSpellCheck = input . spellcheck
6873 const isPassword = input . tagName === 'INPUT' && input . type === 'password'
@@ -89,7 +94,7 @@ export function blur() {
8994 hideKeyboard ( )
9095 removeCaret ( )
9196 }
92- resizeObserver . unobserve ( input )
97+ resizeObserver ? .unobserve ( input )
9398 input . spellcheck = originalSpellCheck
9499 input = null
95100 Module . ccall ( 'focus_out' , 'void' , [ ] , [ ] )
You can’t perform that action at this time.
0 commit comments