mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
LibWeb: Don't load stylesheets with rel="alternate"
We're not supposed to load these by default. Alternate stylesheets can be offered in a menu or something, if the user is interested.
This commit is contained in:
parent
2f26d4c6a1
commit
9bb4020195
2 changed files with 25 additions and 1 deletions
|
@ -47,7 +47,7 @@ void HTMLLinkElement::inserted_into(Node& node)
|
|||
{
|
||||
HTMLElement::inserted_into(node);
|
||||
|
||||
if (rel().split_view(' ').contains_slow("stylesheet"))
|
||||
if (m_relationship & Relationship::Stylesheet && !(m_relationship & Relationship::Alternate))
|
||||
load_stylesheet(document().complete_url(href()));
|
||||
}
|
||||
|
||||
|
@ -87,4 +87,18 @@ void HTMLLinkElement::load_stylesheet(const URL& url)
|
|||
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
|
||||
}
|
||||
|
||||
void HTMLLinkElement::parse_attribute(const FlyString& name, const String& value)
|
||||
{
|
||||
if (name == HTML::AttributeNames::rel) {
|
||||
m_relationship = 0;
|
||||
auto parts = value.split_view(' ');
|
||||
for (auto& part : parts) {
|
||||
if (part == "stylesheet")
|
||||
m_relationship |= Relationship::Stylesheet;
|
||||
else if (part == "alternate")
|
||||
m_relationship |= Relationship::Alternate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue