1
1
import '@webcomponents/custom-elements' ;
2
- import $ from 'jquery' ;
3
2
import { isVisible , LintFramework , leafNodes } from 'lint-framework' ;
4
3
import ProtocolClient from '../ProtocolClient' ;
5
4
@@ -19,24 +18,31 @@ const keepAliveCallback = () => {
19
18
keepAliveCallback ( ) ;
20
19
21
20
function 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
+ ) {
24
28
return ;
25
29
}
26
30
27
- fw . addTarget ( this as HTMLTextAreaElement ) ;
31
+ fw . addTarget ( element ) ;
28
32
} ) ;
29
33
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
+ }
34
40
35
- fw . addTarget ( this as HTMLInputElement ) ;
36
- } ) ;
41
+ fw . addTarget ( element ) ;
42
+ } ) ;
37
43
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 ) ;
40
46
41
47
for ( const leaf of leafs ) {
42
48
if ( ! isVisible ( leaf ) ) {
@@ -47,8 +53,8 @@ function scan() {
47
53
}
48
54
} ) ;
49
55
50
- $ ( '[contenteditable="true"],[contenteditable]' ) . each ( function ( ) {
51
- const leafs = leafNodes ( this ) ;
56
+ document . querySelectorAll ( '[contenteditable="true"],[contenteditable]' ) . forEach ( ( element ) => {
57
+ const leafs = leafNodes ( element ) ;
52
58
53
59
for ( const leaf of leafs ) {
54
60
if ( leaf . parentElement ?. closest ( '[contenteditable="false"],[disabled],[readonly]' ) != null ) {
0 commit comments