mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-23 02:31:55 +00:00
LibJS: Stop lazily coercing numeric PropertyKey
s
Lazily coercing might have made sense in the past, but since hashing and comparing requires the `PropertyKey` to be coerced, and since a `PropertyKey` will be used to index into a hashmap 99% of the time, which will hash the `PropertyKey` and use it in comparisons, the extra complexity and branching produced by lazily coercing has become more trouble than it is worth. Remove the lazy coercions, which then also neatly allows us to switch to a `Variant`-based implementation.
This commit is contained in:
parent
6de4f75d32
commit
cfb00ba494
Notes:
github-actions[bot]
2024-12-01 09:43:49 +00:00
Author: https://github.com/yyny
Commit: cfb00ba494
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2670
4 changed files with 59 additions and 126 deletions
|
@ -118,7 +118,7 @@ Variant<GC::Ref<DOM::HTMLCollection>, GC::Ref<DOM::Element>, Empty> HTMLAllColle
|
|||
return Empty {};
|
||||
|
||||
// 2. Return the result of getting the "all"-indexed or named element(s) from this, given nameOrIndex.
|
||||
return get_the_all_indexed_or_named_elements(name_or_index.value());
|
||||
return get_the_all_indexed_or_named_elements(name_or_index.value().to_deprecated_fly_string());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#dom-htmlallcollection-nameditem
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue