fix data attrs, support scfript

This commit is contained in:
Sara Vieira 2022-12-22 14:28:12 +00:00
parent 19af976dcb
commit ae1462cdb8
2 changed files with 4 additions and 3 deletions

View File

@ -357,7 +357,7 @@ impl Declare {
write!(f, "<{}", #name)?;
#print_attrs
for (key, value) in &self.data_attributes {
write!(f, " data-{}=\"{}\"", key,
write!(f, " data-{}=\"{}\"", str::replace(key, "_", "-"),
crate::escape_html_attribute(value.to_string()))?;
}
for (key, value) in &self.aria_attributes {

View File

@ -31,6 +31,7 @@ macro_rules! marker_trait {
};
}
marker_trait!(HTMLContent);
marker_trait!(MetadataContent);
marker_trait!(FlowContent);
marker_trait!(SectioningContent);
@ -53,7 +54,7 @@ marker_trait!(TableColumnContent);
declare_elements! {
html {
xmlns: Uri,
} with [head, body];
} with [head, body] HTMLContent;
head with [title] MetadataContent;
body with FlowContent;
@ -311,7 +312,7 @@ declare_elements! {
src: Uri,
text: String,
type: String, // TODO could be an enum
} in [MetadataContent, FlowContent, PhrasingContent, TableColumnContent] with TextNode;
} in [MetadataContent, FlowContent, PhrasingContent, TableColumnContent, HTMLContent] with TextNode;
section in [FlowContent, SectioningContent] with FlowContent;
select {
autocomplete: String,