Deprecate `attribute` methods

This commit is contained in:
Alexis Fontaine 2022-04-10 23:40:51 +02:00
parent 6b567408fb
commit c54fd7e21e
1 changed files with 34 additions and 32 deletions

View File

@ -713,12 +713,6 @@ impl<A> DomBuilder<A> where A: AsRef<Element> {
#[inline]
pub fn attr<B>(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<B>(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<A> DomBuilder<A> where A: AsRef<Element> {
self
}
#[deprecated(since = "0.5.24", note = "Use the `attr` method instead")]
#[inline]
pub fn attr_ns<B>(self, namespace: &str, name: B, value: &str) -> Self where B: MultiStr {
self.attribute_namespace(namespace, name, value)
pub fn attribute<B>(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<B>(self, namespace: &str, name: B, value: &str) -> Self where B: MultiStr {
pub fn attr_ns<B>(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<A> DomBuilder<A> where A: AsRef<Element> {
self
}
#[deprecated(since = "0.5.24", note = "Use the `attr_ns` method instead")]
#[inline]
pub fn attribute_namespace<B>(self, namespace: &str, name: B, value: &str) -> Self where B: MultiStr {
self.attr_ns(namespace, name, value)
}
#[inline]
pub fn class<B>(self, name: B) -> Self where B: MultiStr {
let classes = self.element.as_ref().class_list();
@ -802,17 +802,7 @@ impl<A> DomBuilder<A> where A: AsRef<Element> {
}
#[inline]
pub fn attr_signal<B, C, D, E>(self, name: B, value: E) -> Self
where B: MultiStr + 'static,
C: AsStr,
D: OptionStr<Output = C>,
E: Signal<Item = D> + 'static {
self.attribute_signal(name, value)
}
/// The same as the [`attr_signal`](#method.attr_signal) method.
#[inline]
pub fn attribute_signal<B, C, D, E>(mut self, name: B, value: E) -> Self
pub fn attr_signal<B, C, D, E>(mut self, name: B, value: E) -> Self
where B: MultiStr + 'static,
C: AsStr,
D: OptionStr<Output = C>,
@ -822,6 +812,17 @@ impl<A> DomBuilder<A> where A: AsRef<Element> {
self
}
#[deprecated(since = "0.5.24", note = "Use the `attr_signal` method instead")]
#[inline]
pub fn attribute_signal<B, C, D, E>(self, name: B, value: E) -> Self
where B: MultiStr + 'static,
C: AsStr,
D: OptionStr<Output = C>,
E: Signal<Item = D> + 'static {
self.attr_signal(name, value)
}
// TODO should this inline ?
fn set_attribute_namespace_signal<B, C, D, E>(&mut self, namespace: &str, name: B, value: E)
@ -853,17 +854,7 @@ impl<A> DomBuilder<A> where A: AsRef<Element> {
}
#[inline]
pub fn attr_ns_signal<B, C, D, E>(self, namespace: &str, name: B, value: E) -> Self
where B: MultiStr + 'static,
C: AsStr,
D: OptionStr<Output = C>,
E: Signal<Item = D> + '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<B, C, D, E>(mut self, namespace: &str, name: B, value: E) -> Self
pub fn attr_ns_signal<B, C, D, E>(mut self, namespace: &str, name: B, value: E) -> Self
where B: MultiStr + 'static,
C: AsStr,
D: OptionStr<Output = C>,
@ -873,6 +864,17 @@ impl<A> DomBuilder<A> where A: AsRef<Element> {
self
}
#[deprecated(since = "0.5.24", note = "Use the `attr_ns_signal` method instead")]
#[inline]
pub fn attribute_namespace_signal<B, C, D, E>(self, namespace: &str, name: B, value: E) -> Self
where B: MultiStr + 'static,
C: AsStr,
D: OptionStr<Output = C>,
E: Signal<Item = D> + 'static {
self.attr_ns_signal(namespace, name, value)
}
// TODO should this inline ?
fn set_class_signal<B, C>(&mut self, name: B, value: C)