From 37969ff6529756058fe88a2e23f5f5966183ab34 Mon Sep 17 00:00:00 2001 From: Kornel Date: Thu, 5 Dec 2024 13:01:00 +0000 Subject: [PATCH] wasm_bindgen(method) is only for extern types --- js-api/src/comment.rs | 2 +- js-api/src/doctype.rs | 6 +++--- js-api/src/element.rs | 20 ++++++++++---------- js-api/src/lib.rs | 2 +- js-api/src/text_chunk.rs | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/js-api/src/comment.rs b/js-api/src/comment.rs index 398ac3d4..63227509 100644 --- a/js-api/src/comment.rs +++ b/js-api/src/comment.rs @@ -9,7 +9,7 @@ impl_mutations!(Comment); #[wasm_bindgen] impl Comment { - #[wasm_bindgen(method, getter)] + #[wasm_bindgen(getter)] pub fn text(&self) -> JsResult { self.0.get().map(|c| c.text()) } diff --git a/js-api/src/doctype.rs b/js-api/src/doctype.rs index fea061a6..42510bbf 100644 --- a/js-api/src/doctype.rs +++ b/js-api/src/doctype.rs @@ -8,17 +8,17 @@ impl_from_native!(NativeDoctype --> Doctype); #[wasm_bindgen] impl Doctype { - #[wasm_bindgen(method, getter)] + #[wasm_bindgen(getter)] pub fn name(&self) -> JsResult> { self.0.get().map(|d| d.name()) } - #[wasm_bindgen(method, getter=publicId)] + #[wasm_bindgen(getter=publicId)] pub fn public_id(&self) -> JsResult> { self.0.get().map(|d| d.public_id()) } - #[wasm_bindgen(method, getter=systemId)] + #[wasm_bindgen(getter=systemId)] pub fn system_id(&self) -> JsResult> { self.0.get().map(|d| d.system_id()) } diff --git a/js-api/src/element.rs b/js-api/src/element.rs index a53cd2b2..5095b439 100644 --- a/js-api/src/element.rs +++ b/js-api/src/element.rs @@ -26,22 +26,22 @@ impl_mutations!(Element); #[wasm_bindgen] impl Element { - #[wasm_bindgen(method, getter=tagName)] + #[wasm_bindgen(getter=tagName)] pub fn tag_name(&self) -> JsResult { self.0.get().map(|e| e.tag_name()) } - #[wasm_bindgen(method, setter=tagName)] + #[wasm_bindgen(setter=tagName)] pub fn set_tag_name(&mut self, name: &str) -> JsResult<()> { self.0.get_mut()?.set_tag_name(name).into_js_result() } - #[wasm_bindgen(method, getter=namespaceURI)] + #[wasm_bindgen(getter=namespaceURI)] pub fn namespace_uri(&self) -> JsResult { self.0.get().map(|e| e.namespace_uri().into()) } - #[wasm_bindgen(method, getter)] + #[wasm_bindgen(getter)] pub fn attributes(&self) -> JsResult { self.0 .get() @@ -54,17 +54,17 @@ impl Element { .and_then(|a| to_js_value(&a).into_js_result()) } - #[wasm_bindgen(method, js_name=getAttribute)] + #[wasm_bindgen(js_name=getAttribute)] pub fn get_attribute(&self, name: &str) -> JsResult> { self.0.get().map(|e| e.get_attribute(name)) } - #[wasm_bindgen(method, js_name=hasAttribute)] + #[wasm_bindgen(js_name=hasAttribute)] pub fn has_attribute(&self, name: &str) -> JsResult { self.0.get().map(|e| e.has_attribute(name)) } - #[wasm_bindgen(method, js_name=setAttribute)] + #[wasm_bindgen(js_name=setAttribute)] pub fn set_attribute(&mut self, name: &str, value: &str) -> JsResult<()> { self.0 .get_mut()? @@ -72,7 +72,7 @@ impl Element { .into_js_result() } - #[wasm_bindgen(method, js_name=removeAttribute)] + #[wasm_bindgen(js_name=removeAttribute)] pub fn remove_attribute(&mut self, name: &str) -> JsResult<()> { self.0.get_mut().map(|e| e.remove_attribute(name)) } @@ -97,7 +97,7 @@ impl Element { .map(|e| e.append(content, content_type.into_native())) } - #[wasm_bindgen(method, js_name=setInnerContent)] + #[wasm_bindgen(js_name=setInnerContent)] pub fn set_inner_content( &mut self, content: &str, @@ -108,7 +108,7 @@ impl Element { .map(|e| e.set_inner_content(content, content_type.into_native())) } - #[wasm_bindgen(method, js_name=removeAndKeepContent)] + #[wasm_bindgen(js_name=removeAndKeepContent)] pub fn remove_and_keep_content(&mut self) -> Result<(), JsValue> { self.0.get_mut().map(|e| e.remove_and_keep_content()) } diff --git a/js-api/src/lib.rs b/js-api/src/lib.rs index 43fafaea..10bc247d 100644 --- a/js-api/src/lib.rs +++ b/js-api/src/lib.rs @@ -148,7 +148,7 @@ macro_rules! impl_mutations { self.0.get_mut().map(|o| o.remove()) } - #[wasm_bindgen(method, getter)] + #[wasm_bindgen(getter)] pub fn removed(&self) -> JsResult { self.0.get().map(|o| o.removed()) } diff --git a/js-api/src/text_chunk.rs b/js-api/src/text_chunk.rs index 9b4e85ef..87ba2f87 100644 --- a/js-api/src/text_chunk.rs +++ b/js-api/src/text_chunk.rs @@ -9,12 +9,12 @@ impl_mutations!(TextChunk); #[wasm_bindgen] impl TextChunk { - #[wasm_bindgen(method, getter)] + #[wasm_bindgen(getter)] pub fn text(&self) -> JsResult { self.0.get().map(|c| c.as_str().into()) } - #[wasm_bindgen(method, getter=lastInTextNode)] + #[wasm_bindgen(getter=lastInTextNode)] pub fn last_in_text_node(&self) -> JsResult { self.0.get().map(|c| c.last_in_text_node()) }