Struct silkenweb::elements::ScriptBuilder [−][src]
pub struct ScriptBuilder(_);
Implementations
impl ScriptBuilder
[src]
impl ScriptBuilder
[src]pub fn id(self, value: impl AttributeValue<String>) -> ScriptBuilder
[src]
pub fn class(self, value: impl AttributeValue<String>) -> ScriptBuilder
[src]
pub fn async_(self, value: impl AttributeValue<bool>) -> ScriptBuilder
[src]
For classic scripts, if the async attribute is present, then the classic script will be fetched in parallel to parsing and evaluated as soon as it is available.
For module scripts, if the async attribute is present then the scripts and all their dependencies will be executed in the defer queue, therefore they will get fetched in parallel to parsing and evaluated as soon as they are available.
This attribute allows the elimination of parser-blocking JavaScript where the browser would have to load and evaluate scripts before continuing to parse. defer has a similar effect in this case.
pub fn crossorigin(self, value: impl AttributeValue<String>) -> ScriptBuilder
[src]
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.
pub fn defer(self, value: impl AttributeValue<bool>) -> ScriptBuilder
[src]
Indicates to a browser that the script is meant to be executed after the document has been parsed, but before firing DOMContentLoaded.
Scripts with the defer attribute will prevent the DOMContentLoaded event from firing until the script has loaded and finished evaluating.
This attribute must not be used if the src attribute is absent (i.e. for inline scripts), in this case it would have no effect.
The defer attribute has no effect on module scripts — they defer by default.
Scripts with the defer attribute will execute in the order in which they appear in the document.
This attribute allows the elimination of parser-blocking JavaScript where the browser would have to load and evaluate scripts before continuing to parse. async has a similar effect in this case.
pub fn integrity(self, value: impl AttributeValue<String>) -> ScriptBuilder
[src]
This attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation.
pub fn nomodule(self, value: impl AttributeValue<bool>) -> ScriptBuilder
[src]
Indicates that the script should not be executed in browsers that support ES2015 modules — in effect, this can be used to serve fallback scripts to older browsers that do not support modular JavaScript code.
pub fn nonce(self, value: impl AttributeValue<String>) -> ScriptBuilder
[src]
A cryptographic nonce (number used once) to whitelist scripts in a script-src Content-Security-Policy. The server must generate a unique nonce value each time it transmits a policy. It is critical to provide a nonce that cannot be guessed as bypassing a resource’s policy is otherwise trivial.
pub fn referrerpolicy(self, value: impl AttributeValue<String>) -> ScriptBuilder
[src]
Indicates which referrer to send when fetching the script, or resources fetched by the script.
pub fn src(self, value: impl AttributeValue<String>) -> ScriptBuilder
[src]
This attribute specifies the URI of an external script; this can be used as an alternative to embedding a script directly within a document.
pub fn type_(self, value: impl AttributeValue<String>) -> ScriptBuilder
[src]
This attribute indicates the type of script represented. The value of this attribute will be in one of the following categories:
- Omitted or a JavaScript MIME type: This indicates the script is JavaScript. The HTML5 specification urges authors to omit the attribute rather than provide a redundant MIME type.
module
: Causes the code to be treated as a JavaScript module. The processing of the script contents is not affected by the charset and defer attributes. Unlike classic scripts, module scripts require the use of the CORS protocol for cross-origin fetching.- Any other value: The embedded content is treated as a data block which won’t be processed by the browser. Developers must use a valid MIME type that is not a JavaScript MIME type to denote data blocks. The src attribute will be ignored.
impl ScriptBuilder
[src]
impl ScriptBuilder
[src]pub fn on_blur(
self,
f: impl FnMut(FocusEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
[src]
self,
f: impl FnMut(FocusEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
pub fn on_click(
self,
f: impl FnMut(MouseEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
[src]
self,
f: impl FnMut(MouseEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
pub fn on_change(
self,
f: impl FnMut(Event, HtmlScriptElement) + 'static
) -> ScriptBuilder
[src]
self,
f: impl FnMut(Event, HtmlScriptElement) + 'static
) -> ScriptBuilder
pub fn on_dblclick(
self,
f: impl FnMut(MouseEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
[src]
self,
f: impl FnMut(MouseEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
pub fn on_focusout(
self,
f: impl FnMut(FocusEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
[src]
self,
f: impl FnMut(FocusEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
pub fn on_input(
self,
f: impl FnMut(InputEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
[src]
self,
f: impl FnMut(InputEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
pub fn on_keydown(
self,
f: impl FnMut(KeyboardEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
[src]
self,
f: impl FnMut(KeyboardEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
pub fn on_keyup(
self,
f: impl FnMut(KeyboardEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
[src]
self,
f: impl FnMut(KeyboardEvent, HtmlScriptElement) + 'static
) -> ScriptBuilder
pub fn effect(self, f: impl Effect<HtmlScriptElement>) -> ScriptBuilder
[src]
impl ScriptBuilder
[src]
impl ScriptBuilder
[src]pub fn text(self, child: impl Text) -> ScriptBuilder
[src]
pub fn child<Child>(self, c: Child) -> ScriptBuilder where
Child: Into<Element>,
[src]
Child: Into<Element>,
Trait Implementations
impl Builder for ScriptBuilder
[src]
impl Builder for ScriptBuilder
[src]type Target = Script
pub fn build(self) -> <ScriptBuilder as Builder>::Target
[src]
pub fn into_element(self) -> Element
[src]
impl DomElement for ScriptBuilder
[src]
impl DomElement for ScriptBuilder
[src]type Target = HtmlScriptElement
pub fn dom_element(&self) -> <ScriptBuilder as DomElement>::Target
[src]
impl From<ScriptBuilder> for ElementBuilder
[src]
impl From<ScriptBuilder> for ElementBuilder
[src]pub fn from(builder: ScriptBuilder) -> ElementBuilder
[src]
impl From<ScriptBuilder> for Element
[src]
impl From<ScriptBuilder> for Element
[src]pub fn from(builder: ScriptBuilder) -> Element
[src]
Auto Trait Implementations
impl !RefUnwindSafe for ScriptBuilder
impl !RefUnwindSafe for ScriptBuilder
impl !Send for ScriptBuilder
impl !Send for ScriptBuilder
impl !Sync for ScriptBuilder
impl !Sync for ScriptBuilder
impl Unpin for ScriptBuilder
impl Unpin for ScriptBuilder
impl !UnwindSafe for ScriptBuilder
impl !UnwindSafe for ScriptBuilder