mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 19:57:41 +00:00
LibWeb: Add icon as possible resource type on the link tag
This commit is contained in:
parent
44d78a8a13
commit
13847aa7e8
2 changed files with 10 additions and 1 deletions
|
@ -55,9 +55,15 @@ void HTMLLinkElement::inserted()
|
||||||
|
|
||||||
void HTMLLinkElement::parse_attribute(FlyString const& name, String const& value)
|
void HTMLLinkElement::parse_attribute(FlyString const& name, String const& value)
|
||||||
{
|
{
|
||||||
|
// 4.6.7 Link types - https://html.spec.whatwg.org/multipage/links.html#linkTypes
|
||||||
if (name == HTML::AttributeNames::rel) {
|
if (name == HTML::AttributeNames::rel) {
|
||||||
m_relationship = 0;
|
m_relationship = 0;
|
||||||
auto parts = value.split_view(' ');
|
// Keywords are always ASCII case-insensitive, and must be compared as such.
|
||||||
|
auto lowercased_value = value.to_lowercase();
|
||||||
|
// To determine which link types apply to a link, a, area, or form element,
|
||||||
|
// the element's rel attribute must be split on ASCII whitespace.
|
||||||
|
// The resulting tokens are the keywords for the link types that apply to that element.
|
||||||
|
auto parts = lowercased_value.split_view(' ');
|
||||||
for (auto& part : parts) {
|
for (auto& part : parts) {
|
||||||
if (part == "stylesheet"sv)
|
if (part == "stylesheet"sv)
|
||||||
m_relationship |= Relationship::Stylesheet;
|
m_relationship |= Relationship::Stylesheet;
|
||||||
|
@ -69,6 +75,8 @@ void HTMLLinkElement::parse_attribute(FlyString const& name, String const& value
|
||||||
m_relationship |= Relationship::DNSPrefetch;
|
m_relationship |= Relationship::DNSPrefetch;
|
||||||
else if (part == "preconnect"sv)
|
else if (part == "preconnect"sv)
|
||||||
m_relationship |= Relationship::Preconnect;
|
m_relationship |= Relationship::Preconnect;
|
||||||
|
else if (part == "icon"sv)
|
||||||
|
m_relationship |= Relationship::Icon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ private:
|
||||||
Preload = 1 << 2,
|
Preload = 1 << 2,
|
||||||
DNSPrefetch = 1 << 3,
|
DNSPrefetch = 1 << 3,
|
||||||
Preconnect = 1 << 4,
|
Preconnect = 1 << 4,
|
||||||
|
Icon = 1 << 5,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue