Auto merge of #29646 - CYBAI:fix-classname-filter, r=jdm

Fix checking for empty set in getElementsByClassName

Because empty set with `.all(predicate)` will always return `true`, it will result in always filtering wrong elements when the classes is empty set.

Thus, we return earlier with `always_empty` HTMLCollection in the empty classes case so that we can avoid filtering on empty sets.

With adding the checking, we can fix the failures in `/dom/nodes/getElementsByClassName-empty-set.html`.

---

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)
- [x] There are tests for these changes
This commit is contained in:
bors-servo 2023-04-24 07:55:25 +02:00 committed by GitHub
commit c44c6e8c11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 10 deletions

View file

@ -1,10 +0,0 @@
[getElementsByClassName-empty-set.html]
[Passing a space to getElementsByClassName should return an empty HTMLCollection]
expected: FAIL
[Passing three spaces to getElementsByClassName should return an empty HTMLCollection]
expected: FAIL
[Passing an empty string to getElementsByClassName should return an empty HTMLCollection]
expected: FAIL