Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions typed-html/src/elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ declare_elements! {
formmethod: FormMethod,
formnovalidate: Bool,
formtarget: Target,
name: Id,
name: String,
type: ButtonType,
value: String,
} in [FlowContent, PhrasingContent, InteractiveContent, FormContent] with PhrasingContent;
Expand Down Expand Up @@ -171,7 +171,7 @@ declare_elements! {
autocomplete: OnOff,
enctype: FormEncodingType,
method: FormMethod,
name: Id,
name: String,
novalidate: Bool,
target: Target,
} in [FlowContent] with FlowContent;
Expand Down Expand Up @@ -230,7 +230,7 @@ declare_elements! {
min: String,
minlength: usize,
multiple: Bool,
name: Id,
name: String,
pattern: String,
placeholder: String,
readonly: Bool,
Expand Down Expand Up @@ -288,7 +288,7 @@ declare_elements! {
output {
for: SpacedSet<Id>,
form: Id,
name: Id,
name: String,
} in [FlowContent, PhrasingContent, FormContent] with PhrasingContent;
p in [FlowContent] with PhrasingContent;
pre in [FlowContent] with PhrasingContent;
Expand Down Expand Up @@ -320,7 +320,7 @@ declare_elements! {
disabled: Bool,
form: Id,
multiple: Bool,
name: Id,
name: String,
required: Bool,
size: usize,
} in [FlowContent, PhrasingContent, InteractiveContent, FormContent] with SelectContent;
Expand All @@ -339,7 +339,7 @@ declare_elements! {
form: Id,
maxlength: usize,
minlength: usize,
name: Id,
name: String,
placeholder: String,
readonly: Bool,
required: Bool,
Expand Down Expand Up @@ -512,3 +512,24 @@ fn test_twitter_cards() {
frag.to_string()
);
}

#[test]
fn test_form_element_names_can_be_any_string() {
use crate as axohtml;
use crate::{dom::DOMTree, html};

let frag: DOMTree<String> = html!(
<form name="form[0]">
<input type="text" name="form[0].text"/>
<button name="form[0].button"/>
<output name="form[0].output"/>
<select name="form[0].select"/>
<textarea name="form[0].textarea"/>
</form>
);

assert_eq!(
"<form name=\"form[0]\"><input name=\"form[0].text\" type=\"text\"/><button name=\"form[0].button\"></button><output name=\"form[0].output\"></output><select name=\"form[0].select\"></select><textarea name=\"form[0].textarea\"></textarea></form>",
frag.to_string()
);
}