allow unsafe text in script
This commit is contained in:
parent
19af976dcb
commit
59fa2fd099
|
@ -311,7 +311,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] with PhrasingContent;
|
||||
section in [FlowContent, SectioningContent] with FlowContent;
|
||||
select {
|
||||
autocomplete: String,
|
||||
|
@ -488,3 +488,18 @@ fn test_aria() {
|
|||
frag.to_string()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_js() {
|
||||
use crate as axohtml;
|
||||
use crate::{dom::DOMTree, html, text, unsafe_text};
|
||||
|
||||
let frag: DOMTree<String> = html!(<script>{unsafe_text!("console.log('{}')", "sup")}</script>);
|
||||
let frag1: DOMTree<String> = html!(<script>{text!("console.log('{}')", "sup")}</script>);
|
||||
|
||||
assert_eq!("<script>console.log('sup')</script>", frag.to_string());
|
||||
assert_eq!(
|
||||
"<script>console.log('sup')</script>",
|
||||
frag1.to_string()
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue