chore(web): Replace className with classList and indexOf with includes
- Dominant language
- Pascal
- Stars
- 534
- Forks
- 143
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 113
Description
Scope of dom/domEventHandlers and dom/domManager
Replace
```
} else if(el?.className?.indexOf('kmw-disabled') >= 0) {
```
with
```suggestion
} else if(el?.classList?.indexOf('kmw-disabled') >= 0) {
```
. And then replace
```
} else if(el?.classList?.indexOf('kmw-disabled') >= 0) {
```
with
```suggestion
} else if(el?.classList?.includes('kmw-disabled')) {
```
Tidier because it's not a substring match and `classList` is [supported](https://caniuse.com/?search=classlist) in all our environments (`includes()` is not, although probably okay because of es6-shim?)
_Originally posted by @mcdurdin in https://github.com/keymanapp/keyman/pull/7662#discussion_r1017457782_
Also investigate to see if this applies to domManager (it has several references to `className.indexOf('kmw-disabled')`
Contributor guide
Assessment
This issue has not been assessed yet.