Remove ref_filter_map dependency (#36857)

Instead, use the `filter_map` functions of `std::cell::Ref` and
`accountable_refcell::Ref`, which provide the same functionality as
`ref_filter_map`.

Testing: Refactoring for removing dependency. No extra test is needed.
Fixes: #36851

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
This commit is contained in:
Kingsley Yung 2025-05-18 22:00:58 +08:00 committed by GitHub
parent edea2caec1
commit 1271dbf6ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 15 additions and 23 deletions

View file

@ -66,7 +66,7 @@ use xml5ever::serialize::TraversalScope::{
use crate::conversions::Convert;
use crate::dom::activation::Activatable;
use crate::dom::attr::{Attr, AttrHelpersForLayout, is_relevant_attribute};
use crate::dom::bindings::cell::{DomRefCell, Ref, RefMut, ref_filter_map};
use crate::dom::bindings::cell::{DomRefCell, Ref, RefMut};
use crate::dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use crate::dom::bindings::codegen::Bindings::ElementBinding::{
@ -1480,7 +1480,7 @@ impl Element {
// is "xmlns", and local name is prefix, or if prefix is null and it has an attribute
// whose namespace is the XMLNS namespace, namespace prefix is null, and local name is
// "xmlns", then return its value if it is not the empty string, and null otherwise."
let attr = ref_filter_map(self.attrs(), |attrs| {
let attr = Ref::filter_map(self.attrs(), |attrs| {
attrs.iter().find(|attr| {
if attr.namespace() != &ns!(xmlns) {
return false;
@ -1493,7 +1493,8 @@ impl Element {
_ => false,
}
})
});
})
.ok();
if let Some(attr) = attr {
return (**attr.value()).into();