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)?; write!(f, "<{}", #name)?;
#print_attrs #print_attrs
for (key, value) in &self.data_attributes { for (key, value) in &self.data_attributes {
write!(f, " data-{}=\"{}\"", key, write!(f, " data-{}=\"{}\"", str::replace(key, "_", "-"),
crate::escape_html_attribute(value.to_string()))?; crate::escape_html_attribute(value.to_string()))?;
} }
for (key, value) in &self.aria_attributes { 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!(MetadataContent);
marker_trait!(FlowContent); marker_trait!(FlowContent);
marker_trait!(SectioningContent); marker_trait!(SectioningContent);
@ -53,7 +54,7 @@ marker_trait!(TableColumnContent);
declare_elements! { declare_elements! {
html { html {
xmlns: Uri, xmlns: Uri,
} with [head, body]; } with [head, body] HTMLContent;
head with [title] MetadataContent; head with [title] MetadataContent;
body with FlowContent; body with FlowContent;
@ -311,7 +312,7 @@ declare_elements! {
src: Uri, src: Uri,
text: String, text: String,
type: String, // TODO could be an enum 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; section in [FlowContent, SectioningContent] with FlowContent;
select { select {
autocomplete: String, autocomplete: String,