Skip to content

Commit c50ce20

Browse files
committed
LibWeb: Allow event handler attributes on HTMLLinkElement
We were neglecting to set up event handlers for these due to a missing call to the base class in HTMLLinkElement::parse_attribute().
1 parent b97004e commit c50ce20

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
link element onload
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script src="include.js"></script>
2+
<script>
3+
let link = document.createElement("link");
4+
link.setAttribute("rel", "preload");
5+
link.setAttribute("href", "valid.css");
6+
link.setAttribute("as", "style");
7+
link.setAttribute("onload", "println('link element onload')");
8+
document.head.appendChild(link);
9+
</script>

Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ bool HTMLLinkElement::has_loaded_icon() const
7979

8080
void HTMLLinkElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
8181
{
82+
HTMLElement::parse_attribute(name, value);
83+
8284
// 4.6.7 Link types - https://html.spec.whatwg.org/multipage/links.html#linkTypes
8385
if (name == HTML::AttributeNames::rel) {
8486
m_relationship = 0;

0 commit comments

Comments
 (0)