#[repr(C)]pub(crate) struct HTMLScriptElement {Show 14 fields
htmlelement: HTMLElement,
delaying_the_load_event: DomRefCell<Option<LoadBlocker>>,
already_started: Cell<bool>,
parser_inserted: Cell<bool>,
non_blocking: Cell<bool>,
parser_document: Dom<Document>,
preparation_time_document: MutNullableDom<Document>,
line_number: u64,
id: ScriptId,
script_text: DomRefCell<DOMString>,
from_an_external_file: Cell<bool>,
blocking: MutNullableDom<DOMTokenList>,
marked_as_render_blocking: Cell<bool>,
result: DomRefCell<Option<Result<Script, ()>>>,
}Fields§
§htmlelement: HTMLElement§delaying_the_load_event: DomRefCell<Option<LoadBlocker>>§already_started: Cell<bool>§parser_inserted: Cell<bool>§non_blocking: Cell<bool>https://html.spec.whatwg.org/multipage/#non-blocking
(currently unused)
parser_document: Dom<Document>Document of the parser that created this element https://html.spec.whatwg.org/multipage/#parser-document
preparation_time_document: MutNullableDom<Document>Prevents scripts that move between documents during preparation from executing. https://html.spec.whatwg.org/multipage/#preparation-time-document
line_number: u64Track line line_number
id: ScriptIdUnique id for each script element
script_text: DomRefCell<DOMString>§from_an_external_file: Cell<bool>§blocking: MutNullableDom<DOMTokenList>§marked_as_render_blocking: Cell<bool>Used to keep track whether we consider this script element render blocking during
prepare
result: DomRefCell<Option<Result<Script, ()>>>Implementations§
Source§impl HTMLScriptElement
impl HTMLScriptElement
fn __assert_parent_type(&self)
Source§impl HTMLScriptElement
impl HTMLScriptElement
fn new_inherited( local_name: LocalName, prefix: Option<Prefix>, document: &Document, creator: ElementCreator, ) -> HTMLScriptElement
pub(crate) fn new( cx: &mut JSContext, local_name: LocalName, prefix: Option<Prefix>, document: &Document, proto: Option<HandleObject<'_>>, creator: ElementCreator, ) -> DomRoot<HTMLScriptElement>
pub(crate) fn get_script_id(&self) -> ScriptId
Sourcefn delay_load_event(&self, document: &Document, url: ServoUrl)
fn delay_load_event(&self, document: &Document, url: ServoUrl)
Marks that element as delaying the load event or not.
https://html.spec.whatwg.org/multipage/#concept-script-delay-load https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag
Sourcefn get_script_kind(&self, script_type: ScriptType) -> ExternalScriptKind
fn get_script_kind(&self, script_type: ScriptType) -> ExternalScriptKind
Helper method to determine the script kind based on attributes and insertion context.
This duplicates the script preparation logic from the HTML spec to determine the script’s active document without full preparation.
https://html.spec.whatwg.org/multipage/#prepare-the-script-element
Sourcefn get_script_active_document(
&self,
script_kind: ExternalScriptKind,
) -> DomRoot<Document>
fn get_script_active_document( &self, script_kind: ExternalScriptKind, ) -> DomRoot<Document>
Source§impl HTMLScriptElement
impl HTMLScriptElement
Sourcepub(crate) fn set_initial_script_text(&self)
pub(crate) fn set_initial_script_text(&self)
Sourcefn prepare_the_script_text(&self, cx: &mut JSContext) -> Fallible<()>
fn prepare_the_script_text(&self, cx: &mut JSContext) -> Fallible<()>
fn has_render_blocking_attribute(&self) -> bool
Sourcefn potentially_render_blocking(&self) -> bool
fn potentially_render_blocking(&self) -> bool
Sourcepub(crate) fn prepare(
&self,
cx: &mut JSContext,
introduction_type_override: Option<&'static CStr>,
)
pub(crate) fn prepare( &self, cx: &mut JSContext, introduction_type_override: Option<&'static CStr>, )
pub(crate) fn queue_error_event(&self)
pub(crate) fn get_script_type(&self) -> Option<ScriptType>
pub(crate) fn set_parser_inserted(&self, parser_inserted: bool)
pub(crate) fn get_parser_inserted(&self) -> bool
pub(crate) fn set_already_started(&self, already_started: bool)
pub(crate) fn get_non_blocking(&self) -> bool
fn dispatch_event(&self, cx: &mut JSContext, type_: Atom) -> bool
fn text(&self) -> DOMString
Trait Implementations§
§impl Castable for HTMLScriptElement
impl Castable for HTMLScriptElement
Source§impl DomObject for HTMLScriptElement
impl DomObject for HTMLScriptElement
type ReflectorType = ()
Source§fn reflector(&self) -> &Reflector<Self::ReflectorType>
fn reflector(&self) -> &Reflector<Self::ReflectorType>
Source§impl DomObjectWrap<DomTypeHolder> for HTMLScriptElement
impl DomObjectWrap<DomTypeHolder> for HTMLScriptElement
Source§const WRAP: unsafe fn(&mut JSContext, &GlobalScope, Option<HandleObject<'_>>, Box<Self>) -> Root<Dom<Self>> = {script_bindings::codegen::GenericBindings::HTMLScriptElementBinding::Wrap::<dom::bindings::codegen::DomTypeHolder::DomTypeHolder> as for<'a, 'b, 'c> unsafe fn(&'a mut js::context::JSContext, &'b dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'c, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::html::htmlscriptelement::HTMLScriptElement>) -> script_bindings::root::Root<script_bindings::root::Dom<dom::html::htmlscriptelement::HTMLScriptElement>>}
const WRAP: unsafe fn(&mut JSContext, &GlobalScope, Option<HandleObject<'_>>, Box<Self>) -> Root<Dom<Self>> = {script_bindings::codegen::GenericBindings::HTMLScriptElementBinding::Wrap::<dom::bindings::codegen::DomTypeHolder::DomTypeHolder> as for<'a, 'b, 'c> unsafe fn(&'a mut js::context::JSContext, &'b dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'c, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::html::htmlscriptelement::HTMLScriptElement>) -> script_bindings::root::Root<script_bindings::root::Dom<dom::html::htmlscriptelement::HTMLScriptElement>>}
Source§impl Drop for HTMLScriptElement
impl Drop for HTMLScriptElement
Source§impl HTMLScriptElementMethods<DomTypeHolder> for HTMLScriptElement
impl HTMLScriptElementMethods<DomTypeHolder> for HTMLScriptElement
Source§fn Src(&self) -> TrustedScriptURLOrUSVString<DomTypeHolder>
fn Src(&self) -> TrustedScriptURLOrUSVString<DomTypeHolder>
Source§fn SetSrc(
&self,
cx: &mut JSContext,
value: TrustedScriptURLOrUSVString<DomTypeHolder>,
) -> Fallible<()>
fn SetSrc( &self, cx: &mut JSContext, value: TrustedScriptURLOrUSVString<DomTypeHolder>, ) -> Fallible<()>
Source§fn GetCrossOrigin(&self) -> Option<DOMString>
fn GetCrossOrigin(&self) -> Option<DOMString>
Source§fn ReferrerPolicy(&self) -> DOMString
fn ReferrerPolicy(&self) -> DOMString
Source§fn InnerText(&self) -> TrustedScriptOrString<DomTypeHolder>
fn InnerText(&self) -> TrustedScriptOrString<DomTypeHolder>
Source§fn SetInnerText(
&self,
cx: &mut JSContext,
input: TrustedScriptOrString<DomTypeHolder>,
) -> Fallible<()>
fn SetInnerText( &self, cx: &mut JSContext, input: TrustedScriptOrString<DomTypeHolder>, ) -> Fallible<()>
Source§fn Text(&self) -> TrustedScriptOrString<DomTypeHolder>
fn Text(&self) -> TrustedScriptOrString<DomTypeHolder>
Source§fn SetText(
&self,
cx: &mut JSContext,
value: TrustedScriptOrString<DomTypeHolder>,
) -> Fallible<()>
fn SetText( &self, cx: &mut JSContext, value: TrustedScriptOrString<DomTypeHolder>, ) -> Fallible<()>
Source§fn GetTextContent(&self) -> Option<TrustedScriptOrString<DomTypeHolder>>
fn GetTextContent(&self) -> Option<TrustedScriptOrString<DomTypeHolder>>
Source§fn SetTextContent(
&self,
cx: &mut JSContext,
value: Option<TrustedScriptOrString<DomTypeHolder>>,
) -> Fallible<()>
fn SetTextContent( &self, cx: &mut JSContext, value: Option<TrustedScriptOrString<DomTypeHolder>>, ) -> Fallible<()>
fn Type(&self) -> DOMString
fn SetType(&self, cx: &mut JSContext, value: DOMString)
fn Charset(&self) -> DOMString
fn SetCharset(&self, cx: &mut JSContext, value: DOMString)
fn Defer(&self) -> bool
fn SetDefer(&self, cx: &mut JSContext, value: bool)
fn NoModule(&self) -> bool
fn SetNoModule(&self, cx: &mut JSContext, value: bool)
fn Integrity(&self) -> DOMString
fn SetIntegrity(&self, cx: &mut JSContext, value: DOMString)
fn Event(&self) -> DOMString
fn SetEvent(&self, cx: &mut JSContext, value: DOMString)
fn HtmlFor(&self) -> DOMString
fn SetHtmlFor(&self, cx: &mut JSContext, value: DOMString)
fn SetReferrerPolicy(&self, cx: &mut JSContext, value: DOMString)
Source§impl HasParent for HTMLScriptElement
impl HasParent for HTMLScriptElement
Source§fn as_parent(&self) -> &HTMLElement
fn as_parent(&self) -> &HTMLElement
This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is
type Parent = HTMLElement
Source§impl IDLInterface for HTMLScriptElement
impl IDLInterface for HTMLScriptElement
Source§const PROTO_FIRST: u16 = 262u16
const PROTO_FIRST: u16 = 262u16
Source§const PROTO_LAST: u16 = 262u16
const PROTO_LAST: u16 = 262u16
Source§impl MallocSizeOf for HTMLScriptElement
impl MallocSizeOf for HTMLScriptElement
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl MutDomObject for HTMLScriptElement
impl MutDomObject for HTMLScriptElement
Source§impl PartialEq for HTMLScriptElement
impl PartialEq for HTMLScriptElement
Source§impl ToJSValConvertible for HTMLScriptElement
impl ToJSValConvertible for HTMLScriptElement
Source§unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)
self to a JSVal. JSAPI failure causes a panic.Source§fn safe_to_jsval(&self, cx: &mut JSContext, rval: MutableHandle<'_, Value>)
fn safe_to_jsval(&self, cx: &mut JSContext, rval: MutableHandle<'_, Value>)
self to a JSVal. JSAPI failure causes a panic.Source§impl Traceable for HTMLScriptElement
impl Traceable for HTMLScriptElement
Source§impl VirtualMethods for HTMLScriptElement
impl VirtualMethods for HTMLScriptElement
Source§fn children_changed(&self, cx: &mut JSContext, mutation: &ChildrenMutation<'_>)
fn children_changed(&self, cx: &mut JSContext, mutation: &ChildrenMutation<'_>)
Source§fn post_connection_steps(&self, cx: &mut JSContext)
fn post_connection_steps(&self, cx: &mut JSContext)
Source§fn super_type(&self) -> Option<&dyn VirtualMethods>
fn super_type(&self) -> Option<&dyn VirtualMethods>
Source§fn attribute_mutated(
&self,
cx: &mut JSContext,
attr: &Attr,
mutation: AttributeMutation<'_>,
)
fn attribute_mutated( &self, cx: &mut JSContext, attr: &Attr, mutation: AttributeMutation<'_>, )
Source§fn cloning_steps(
&self,
cx: &mut JSContext,
copy: &Node,
maybe_doc: Option<&Document>,
clone_children: CloneChildrenFlag,
)
fn cloning_steps( &self, cx: &mut JSContext, copy: &Node, maybe_doc: Option<&Document>, clone_children: CloneChildrenFlag, )
Source§fn unbind_from_tree(&self, cx: &mut JSContext, context: &UnbindContext<'_>)
fn unbind_from_tree(&self, cx: &mut JSContext, context: &UnbindContext<'_>)
Source§fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool
fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool
true if given attribute attr affects style of the
given element.Source§fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue
name
on this element.Source§fn moving_steps(&self, cx: &mut JSContext, context: &MoveContext<'_>)
fn moving_steps(&self, cx: &mut JSContext, context: &MoveContext<'_>)
Source§fn bind_to_tree(&self, cx: &mut JSContext, context: &BindContext<'_>)
fn bind_to_tree(&self, cx: &mut JSContext, context: &BindContext<'_>)
Source§fn handle_event(&self, cx: &mut JSContext, event: &Event)
fn handle_event(&self, cx: &mut JSContext, event: &Event)
Source§fn is_valid_command_steps(&self, command: CommandState) -> bool
fn is_valid_command_steps(&self, command: CommandState) -> bool
Source§fn command_steps(
&self,
cx: &mut JSContext,
button: DomRoot<HTMLButtonElement>,
command: CommandState,
) -> bool
fn command_steps( &self, cx: &mut JSContext, button: DomRoot<HTMLButtonElement>, command: CommandState, ) -> bool
Source§fn adopting_steps(&self, cx: &mut JSContext, old_doc: &Document)
fn adopting_steps(&self, cx: &mut JSContext, old_doc: &Document)
impl DerivedFrom<Element> for HTMLScriptElement
impl DerivedFrom<EventTarget> for HTMLScriptElement
impl DerivedFrom<HTMLElement> for HTMLScriptElement
impl DerivedFrom<Node> for HTMLScriptElement
impl Eq for HTMLScriptElement
Auto Trait Implementations§
impl !Freeze for HTMLScriptElement
impl !RefUnwindSafe for HTMLScriptElement
impl !Send for HTMLScriptElement
impl !Sync for HTMLScriptElement
impl Unpin for HTMLScriptElement
impl !UnwindSafe for HTMLScriptElement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<D, T> DomGlobalGeneric<D> for T
impl<D, T> DomGlobalGeneric<D> for T
Source§fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
GlobalScope] of the realm that the DomObject was created in. If this
object is a Node, this will be different from it’s owning Document if adopted by. For
Nodes it’s almost always better to use NodeTraits::owning_global.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more