From c54fd7e21ee67a30873385c93db1bac930ebcc85 Mon Sep 17 00:00:00 2001 From: Alexis Fontaine Date: Sun, 10 Apr 2022 23:40:51 +0200 Subject: [PATCH] Deprecate `attribute` methods --- src/dom.rs | 66 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/src/dom.rs b/src/dom.rs index 2bc04d3..afc948d 100644 --- a/src/dom.rs +++ b/src/dom.rs @@ -713,12 +713,6 @@ impl DomBuilder where A: AsRef { #[inline] pub fn attr(self, name: B, value: &str) -> Self where B: MultiStr { - self.attribute(name, value) - } - - /// The same as the [`attr`](#method.attr) method. - #[inline] - pub fn attribute(self, name: B, value: &str) -> Self where B: MultiStr { let element = self.element.as_ref(); // TODO should this intern the value ? let value: &str = intern(value); @@ -730,14 +724,14 @@ impl DomBuilder where A: AsRef { self } + #[deprecated(since = "0.5.24", note = "Use the `attr` method instead")] #[inline] - pub fn attr_ns(self, namespace: &str, name: B, value: &str) -> Self where B: MultiStr { - self.attribute_namespace(namespace, name, value) + pub fn attribute(self, name: B, value: &str) -> Self where B: MultiStr { + self.attr(name, value) } - /// The same as the [`attr_ns`](#method.attr_ns) method. #[inline] - pub fn attribute_namespace(self, namespace: &str, name: B, value: &str) -> Self where B: MultiStr { + pub fn attr_ns(self, namespace: &str, name: B, value: &str) -> Self where B: MultiStr { let element = self.element.as_ref(); let namespace: &str = intern(namespace); // TODO should this intern the value ? @@ -750,6 +744,12 @@ impl DomBuilder where A: AsRef { self } + #[deprecated(since = "0.5.24", note = "Use the `attr_ns` method instead")] + #[inline] + pub fn attribute_namespace(self, namespace: &str, name: B, value: &str) -> Self where B: MultiStr { + self.attr_ns(namespace, name, value) + } + #[inline] pub fn class(self, name: B) -> Self where B: MultiStr { let classes = self.element.as_ref().class_list(); @@ -802,17 +802,7 @@ impl DomBuilder where A: AsRef { } #[inline] - pub fn attr_signal(self, name: B, value: E) -> Self - where B: MultiStr + 'static, - C: AsStr, - D: OptionStr, - E: Signal + 'static { - self.attribute_signal(name, value) - } - - /// The same as the [`attr_signal`](#method.attr_signal) method. - #[inline] - pub fn attribute_signal(mut self, name: B, value: E) -> Self + pub fn attr_signal(mut self, name: B, value: E) -> Self where B: MultiStr + 'static, C: AsStr, D: OptionStr, @@ -822,6 +812,17 @@ impl DomBuilder where A: AsRef { self } + #[deprecated(since = "0.5.24", note = "Use the `attr_signal` method instead")] + #[inline] + pub fn attribute_signal(self, name: B, value: E) -> Self + where B: MultiStr + 'static, + C: AsStr, + D: OptionStr, + E: Signal + 'static { + + self.attr_signal(name, value) + } + // TODO should this inline ? fn set_attribute_namespace_signal(&mut self, namespace: &str, name: B, value: E) @@ -853,17 +854,7 @@ impl DomBuilder where A: AsRef { } #[inline] - pub fn attr_ns_signal(self, namespace: &str, name: B, value: E) -> Self - where B: MultiStr + 'static, - C: AsStr, - D: OptionStr, - E: Signal + 'static { - self.attribute_namespace_signal(namespace, name, value) - } - - /// The same as the [`attr_ns_signal`](#method.attr_ns_signal) method. - #[inline] - pub fn attribute_namespace_signal(mut self, namespace: &str, name: B, value: E) -> Self + pub fn attr_ns_signal(mut self, namespace: &str, name: B, value: E) -> Self where B: MultiStr + 'static, C: AsStr, D: OptionStr, @@ -873,6 +864,17 @@ impl DomBuilder where A: AsRef { self } + #[deprecated(since = "0.5.24", note = "Use the `attr_ns_signal` method instead")] + #[inline] + pub fn attribute_namespace_signal(self, namespace: &str, name: B, value: E) -> Self + where B: MultiStr + 'static, + C: AsStr, + D: OptionStr, + E: Signal + 'static { + + self.attr_ns_signal(namespace, name, value) + } + // TODO should this inline ? fn set_class_signal(&mut self, name: B, value: C)