eligrey / eligrey/classList.js

No normalization of add/remove/toggle in IE10 and IE11

Open
#44 17 comments 4 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.1k
Forks
226
PR merge metrics
No merged PRs in 30d

Description

I tested the polyfill in IE10 and IE11 (Win7 on a virtual machine) and the functions still have partial support of classList. Multiple parameters in the add() and remove() functions still don't work.

```
if (!("classList" in document.createElement("_"))
|| document.createElementNS && !("classList" in document.createElementNS("http://www.w3.org/2000/svg", "g"))) {
```

The last condition `!("classList" in document.createElementNS("http://www.w3.org/2000/svg", "g"))` evaluates to true, so the part for no classlist support will be executed.
The part for partial classlist supported browsers won't be executed in IE10/11.

I could "fix" the issue by changing || to && in line18/19:

```
if (!("classList" in document.createElement("_"))
&& document.createElementNS && !("classList" in document.createElementNS("http://www.w3.org/2000/svg", "g"))) {
```

It seems to work for IE10/11, but don't know if is could be an issue for other browsers.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.