Expand description
Build a
<script>
element.
The script HTML element is used to embed executable code or data; this is typically used to embed or refer to
JavaScript code. The script element can also be used with other languages, such as WebGL’s GLSL shader
programming language and JSON.
§Usage in rsx
rsx! {
// Elements are followed by braces that surround any attributes and children for that element
script {
// Add any attributes first
class: "my-class",
"custom-attribute-name": "value",
// Then add any attributes you are spreading into this element
..attributes,
// Then add any children elements, components, text nodes, or raw expressions
div {}
ChildComponent {}
"child text"
{raw_expression}
}
};Constants§
- Usage in rsx
- The HTML class attribute is used to specify a class for an HTML element.
- Normal script elements pass minimal information to the window.onerror for scripts which do not pass the standard CORS checks. To allow error logging for sites which use a separate domain for static media, use this attribute. See CORS settings attributes for a more descriptive explanation of its valid arguments.
- dangerous_inner_html is Dioxus’s replacement for using innerHTML in the browser DOM. In general, setting HTML from code is risky because it’s easy to inadvertently expose your users to a cross-site scripting (XSS) attack. So, you can set HTML directly from Dioxus, but you have to type out dangerous_inner_html to remind yourself that it’s dangerous
- This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing DOMContentLoaded.
- Usage in rsx
- Usage in rsx
- Usage in rsx
- Usage in rsx
- prevent_
default Deprecated This attribute has been deprecated in favor ofdioxus_core::Event::prevent_default - Usage in rsx
- Usage in rsx
- Usage in rsx
- Usage in rsx
- Usage in rsx