mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Allow cloneNode() to clone elements with weird attributes
We can't rely on Element.setAttribute() in cloneNode() since that will throw on weird attribute names. Instead, just follow the spec and copy attributes into cloned elements verbatim. This fixes a crash when loading the "issues" tab on GitHub repos. They are actually sending us unintentionally broken markup, but we should still support cloning it. :^)
This commit is contained in:
parent
d94a6d8873
commit
193fc7ef98
Notes:
sideshowbarker
2024-07-17 11:29:41 +09:00
Author: https://github.com/awesomekling
Commit: 193fc7ef98
Pull-request: https://github.com/SerenityOS/serenity/pull/24060
5 changed files with 19 additions and 1 deletions
|
@ -246,6 +246,12 @@ WebIDL::ExceptionOr<void> Element::set_attribute_ns(Optional<FlyString> const& n
|
|||
return {};
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-element-attributes-append
|
||||
void Element::append_attribute(FlyString const& name, String const& value)
|
||||
{
|
||||
m_attributes->append_attribute(Attr::create(document(), name, value));
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-element-attributes-append
|
||||
void Element::append_attribute(Attr& attribute)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue