Don't render empty attributes when stringifying.
This commit is contained in:
parent
91c3d9864a
commit
ccb00646ac
|
@ -337,8 +337,10 @@ impl Declare {
|
|||
for (attr_name, _, attr_str) in self.attrs() {
|
||||
print_attrs.extend(quote!(
|
||||
if let Some(ref value) = self.attrs.#attr_name {
|
||||
write!(f, " {}=\"{}\"", #attr_str,
|
||||
::htmlescape::encode_attribute(&value.to_string()))?;
|
||||
let value = ::htmlescape::encode_attribute(&value.to_string());
|
||||
if !value.is_empty() {
|
||||
write!(f, " {}=\"{}\"", #attr_str, value)?;
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue