move implementatipn
This commit is contained in:
parent
ae1462cdb8
commit
da3e87a38e
|
@ -357,7 +357,7 @@ impl Declare {
|
|||
write!(f, "<{}", #name)?;
|
||||
#print_attrs
|
||||
for (key, value) in &self.data_attributes {
|
||||
write!(f, " data-{}=\"{}\"", str::replace(key, "_", "-"),
|
||||
write!(f, " data-{}=\"{}\"", key,
|
||||
crate::escape_html_attribute(value.to_string()))?;
|
||||
}
|
||||
for (key, value) in &self.aria_attributes {
|
||||
|
|
|
@ -76,7 +76,10 @@ fn extract_data_attrs(attrs: &mut StringyMap<Ident, TokenTree>) -> StringyMap<St
|
|||
let key_name = key.to_string();
|
||||
if let Some(key_name) = key_name.strip_prefix("data_") {
|
||||
let value = attrs.remove(&key).unwrap();
|
||||
data.insert(key_name.to_string(), value);
|
||||
// makes sure if a data attribute has more than one hyphen
|
||||
// they all get transformed
|
||||
let key = str::replace(key_name, "_", "-");
|
||||
data.insert(key.to_string(), value);
|
||||
}
|
||||
}
|
||||
data
|
||||
|
|
Loading…
Reference in New Issue