File tree Expand file tree Collapse file tree 3 files changed +8
-42
lines changed
src/rewritable_units/tokens Expand file tree Collapse file tree 3 files changed +8
-42
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use lol_html::html_content::EndTag as NativeEndTag;
55pub struct EndTag ( NativeRefWrap < NativeEndTag < ' static > > ) ;
66
77impl_from_native ! ( NativeEndTag => EndTag ) ;
8- impl_mutations_end_tag ! ( EndTag ) ;
8+ impl_mutations ! ( EndTag ) ;
99
1010#[ wasm_bindgen]
1111impl EndTag {
Original file line number Diff line number Diff line change @@ -155,47 +155,6 @@ macro_rules! impl_mutations {
155155 } ;
156156}
157157
158- macro_rules! impl_mutations_end_tag {
159- ( $Ty: ident) => {
160- #[ wasm_bindgen]
161- impl $Ty {
162- pub fn before(
163- & mut self ,
164- content: & str ,
165- content_type: Option <ContentTypeOptions >,
166- ) -> Result <( ) , JsValue > {
167- self . 0
168- . get_mut( )
169- . map( |o| o. before( content, content_type. into_native( ) ) )
170- }
171-
172- pub fn after(
173- & mut self ,
174- content: & str ,
175- content_type: Option <ContentTypeOptions >,
176- ) -> Result <( ) , JsValue > {
177- self . 0
178- . get_mut( )
179- . map( |o| o. after( content, content_type. into_native( ) ) )
180- }
181-
182- pub fn replace(
183- & mut self ,
184- content: & str ,
185- content_type: Option <ContentTypeOptions >,
186- ) -> Result <( ) , JsValue > {
187- self . 0
188- . get_mut( )
189- . map( |o| o. replace( content, content_type. into_native( ) ) )
190- }
191-
192- pub fn remove( & mut self ) -> Result <( ) , JsValue > {
193- self . 0 . get_mut( ) . map( |o| o. remove( ) )
194- }
195- }
196- } ;
197- }
198-
199158macro_rules! impl_from_native {
200159 ( $Ty: ty => $JsTy: path) => {
201160 impl $JsTy {
Original file line number Diff line number Diff line change @@ -141,6 +141,13 @@ impl<'i> EndTag<'i> {
141141 self . mutations . mutate ( ) . remove ( ) ;
142142 }
143143
144+ /// Returns `true` if the end tag has been replaced or removed.
145+ #[ inline]
146+ #[ must_use]
147+ pub fn removed ( & self ) -> bool {
148+ self . mutations . removed ( )
149+ }
150+
144151 #[ inline]
145152 fn serialize_self ( & self , output_handler : & mut dyn FnMut ( & [ u8 ] ) ) -> Result < ( ) , RewritingError > {
146153 if let Some ( raw) = & self . raw {
You can’t perform that action at this time.
0 commit comments