From 2d882ed758a1176e7b41db94dd1158d4ed84beff Mon Sep 17 00:00:00 2001 From: kitsuyui Date: Tue, 15 Oct 2024 14:54:27 +0900 Subject: [PATCH] Update html5ever to 0.29.0 - Implement ElemName to adapt type changes in html5ever 0.29.0 --- Cargo.toml | 2 +- src/lib.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3dc583f..ee8b855 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["sxd_document", "sxd_xpath", "html5ever"] repository = "https://github.com/kitsuyui/sxd_html" [dependencies] -html5ever = "0.28.0" +html5ever = "0.29.0" sxd-document = "0.3.2" [dev-dependencies] diff --git a/src/lib.rs b/src/lib.rs index 8e29aee..dceba2a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,9 +7,9 @@ use std::{ convert::TryFrom, }; -use html5ever::driver::ParseOpts; use html5ever::tendril::TendrilSink; use html5ever::tree_builder::TreeBuilderOpts; +use html5ever::{driver::ParseOpts, ExpandedName}; pub use error::Error; pub(crate) use handle::Handle; @@ -46,6 +46,7 @@ impl<'d> DocHtmlSink<'d> { } impl<'d> TreeSink for DocHtmlSink<'d> { + type ElemName<'a> = ExpandedName<'a> where Self: 'a; type Handle = Handle<'d>; type Output = Vec; @@ -67,7 +68,7 @@ impl<'d> TreeSink for DocHtmlSink<'d> { } // this is only called on elements - fn elem_name<'h>(&'h self, target: &'h Self::Handle) -> html5ever::ExpandedName<'h> { + fn elem_name<'h>(&'h self, target: &'h Self::Handle) -> Self::ElemName<'h> { match target { Handle::Element(_, qualname, _) => qualname.expanded(), _ => panic!("not an element"),