Merge pull request #14 from axodotdev/allow_unsafe
allow unsafe text in script
This commit is contained in:
commit
03efe72dad
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
|
|
||||||
use crate::dom::{Node, TextNode};
|
use crate::dom::{Node, TextNode, UnsafeTextNode};
|
||||||
use crate::types::*;
|
use crate::types::*;
|
||||||
use crate::OutputType;
|
use crate::OutputType;
|
||||||
use axohtml_macros::declare_elements;
|
use axohtml_macros::declare_elements;
|
||||||
|
@ -312,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, HTMLContent] with TextNode;
|
} in [MetadataContent, FlowContent, PhrasingContent, TableColumnContent, HTMLContent] with UnsafeTextNode;
|
||||||
section in [FlowContent, SectioningContent] with FlowContent;
|
section in [FlowContent, SectioningContent] with FlowContent;
|
||||||
select {
|
select {
|
||||||
autocomplete: String,
|
autocomplete: String,
|
||||||
|
@ -489,3 +489,13 @@ fn test_aria() {
|
||||||
frag.to_string()
|
frag.to_string()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_js() {
|
||||||
|
use crate as axohtml;
|
||||||
|
use crate::{dom::DOMTree, html, unsafe_text};
|
||||||
|
|
||||||
|
let frag: DOMTree<String> = html!(<script>{unsafe_text!("console.log('{}')", "sup")}</script>);
|
||||||
|
|
||||||
|
assert_eq!("<script>console.log('sup')</script>", frag.to_string());
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue