script: Don't re-parse link relations when binding element to tree (#44139)

The parsed relations of a element don't depend on its position in the
DOM tree at all, so this does nothing.

Testing: This should not change observable behaviour, WPT should catch
regressions

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker
2026-04-12 23:49:31 +02:00
committed by GitHub
parent 7c5df4e45b
commit 25d3f4b7a9
4 changed files with 23 additions and 50 deletions

View File

@@ -10,7 +10,6 @@ use cssparser::match_ignore_ascii_case;
use dom_struct::dom_struct;
use euclid::default::Point2D;
use html5ever::{LocalName, Prefix, local_name};
use js::context::JSContext;
use js::rust::HandleObject;
use servo_url::ServoUrl;
use style::attr::AttrValue;
@@ -31,7 +30,7 @@ use crate::dom::event::Event;
use crate::dom::eventtarget::EventTarget;
use crate::dom::html::htmlelement::HTMLElement;
use crate::dom::html::htmlhyperlinkelementutils::{HyperlinkElement, HyperlinkElementTraits};
use crate::dom::node::{BindContext, Node};
use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
use crate::links::{LinkRelations, follow_hyperlink};
use crate::script_runtime::CanGc;
@@ -365,15 +364,6 @@ impl VirtualMethods for HTMLAreaElement {
_ => {},
}
}
fn bind_to_tree(&self, cx: &mut JSContext, context: &BindContext) {
if let Some(s) = self.super_type() {
s.bind_to_tree(cx, context);
}
self.relations
.set(LinkRelations::for_element(self.upcast()));
}
}
impl HTMLAreaElementMethods<crate::DomTypeHolder> for HTMLAreaElement {