11import '@webcomponents/custom-elements' ;
2- import $ from 'jquery' ;
32import { isVisible , LintFramework , leafNodes } from 'lint-framework' ;
43import ProtocolClient from '../ProtocolClient' ;
54
@@ -19,24 +18,31 @@ const keepAliveCallback = () => {
1918keepAliveCallback ( ) ;
2019
2120function scan ( ) {
22- $ ( 'textarea:visible' ) . each ( function ( ) {
23- if ( this . getAttribute ( 'data-enable-grammarly' ) == 'false' || this . disabled || this . readOnly ) {
21+ document . querySelectorAll < HTMLTextAreaElement > ( 'textarea' ) . forEach ( ( element ) => {
22+ if (
23+ ! isVisible ( element ) ||
24+ element . getAttribute ( 'data-enable-grammarly' ) === 'false' ||
25+ element . disabled ||
26+ element . readOnly
27+ ) {
2428 return ;
2529 }
2630
27- fw . addTarget ( this as HTMLTextAreaElement ) ;
31+ fw . addTarget ( element ) ;
2832 } ) ;
2933
30- $ ( 'input[type="text"][spellcheck="true"]' ) . each ( function ( ) {
31- if ( this . disabled || this . readOnly ) {
32- return ;
33- }
34+ document
35+ . querySelectorAll < HTMLInputElement > ( 'input[type="text"][spellcheck="true"]' )
36+ . forEach ( ( element ) => {
37+ if ( element . disabled || element . readOnly ) {
38+ return ;
39+ }
3440
35- fw . addTarget ( this as HTMLInputElement ) ;
36- } ) ;
41+ fw . addTarget ( element ) ;
42+ } ) ;
3743
38- $ ( '[data-testid="gutenberg-editor"]' ) . each ( function ( ) {
39- const leafs = leafNodes ( this ) ;
44+ document . querySelectorAll ( '[data-testid="gutenberg-editor"]' ) . forEach ( ( element ) => {
45+ const leafs = leafNodes ( element ) ;
4046
4147 for ( const leaf of leafs ) {
4248 if ( ! isVisible ( leaf ) ) {
@@ -47,8 +53,8 @@ function scan() {
4753 }
4854 } ) ;
4955
50- $ ( '[contenteditable="true"],[contenteditable]' ) . each ( function ( ) {
51- const leafs = leafNodes ( this ) ;
56+ document . querySelectorAll ( '[contenteditable="true"],[contenteditable]' ) . forEach ( ( element ) => {
57+ const leafs = leafNodes ( element ) ;
5258
5359 for ( const leaf of leafs ) {
5460 if ( leaf . parentElement ?. closest ( '[contenteditable="false"],[disabled],[readonly]' ) != null ) {
0 commit comments