mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-25 10:48:53 +00:00
LibWeb: Don't advertise the empty string as HTMLCollection property name
This fixes wpt/dom/collections/HTMLCollection-empty-name.html
This commit is contained in:
parent
8988dce93d
commit
e7febd347b
Notes:
sideshowbarker
2024-07-17 04:09:56 +09:00
Author: https://github.com/awesomekling
Commit: e7febd347b
Pull-request: https://github.com/SerenityOS/serenity/pull/24461
3 changed files with 13 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
Empty string in collection: false
|
||||||
|
'haxx' in collection: true
|
|
@ -0,0 +1,10 @@
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<div id></div>
|
||||||
|
<div id=haxx></div>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
var c = document.getElementsByTagName("*");
|
||||||
|
println("Empty string in collection: " + ("" in c));
|
||||||
|
println("'haxx' in collection: " + ("haxx" in c));
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -135,7 +135,7 @@ Vector<FlyString> HTMLCollection::supported_property_names() const
|
||||||
for (auto const& element : m_cached_elements) {
|
for (auto const& element : m_cached_elements) {
|
||||||
// 1. If element has an ID which is not in result, append element’s ID to result.
|
// 1. If element has an ID which is not in result, append element’s ID to result.
|
||||||
if (auto const& id = element->id(); id.has_value()) {
|
if (auto const& id = element->id(); id.has_value()) {
|
||||||
if (!result.contains_slow(id.value()))
|
if (!id.value().is_empty() && !result.contains_slow(id.value()))
|
||||||
result.append(id.value());
|
result.append(id.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue