HTMLScriptElement

Struct HTMLScriptElement 

Source
#[repr(C)]
pub(crate) struct HTMLScriptElement {
Show 13 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>,
}

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>

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: u64

Track line line_number

§id: ScriptId

Unique 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

Implementations§

Source§

impl HTMLScriptElement

Source§

impl HTMLScriptElement

Source

fn new_inherited( local_name: LocalName, prefix: Option<Prefix>, document: &Document, creator: ElementCreator, ) -> HTMLScriptElement

Source

pub(crate) fn new( cx: &mut JSContext, local_name: LocalName, prefix: Option<Prefix>, document: &Document, proto: Option<HandleObject<'_>>, creator: ElementCreator, ) -> DomRoot<HTMLScriptElement>

Source

pub(crate) fn get_script_id(&self) -> ScriptId

Source

pub(crate) fn delay_load_event(&self, url: ServoUrl)

Marks that element as delaying the load event or not.

Nothing happens if the element was already delaying the load event and we pass true to that method again.

https://html.spec.whatwg.org/multipage/#concept-script-delay-load https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag

Source

pub(crate) fn get_script_kind(&self) -> 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

Source

pub(crate) fn get_script_active_document(&self) -> DomRoot<Document>

Source§

impl HTMLScriptElement

Trait Implementations§

§

impl Castable for HTMLScriptElement

Source§

fn is<T>(&self) -> bool
where T: DerivedFrom<Self>,

Check whether a DOM object implements one of its deriving interfaces.
Source§

fn upcast<T>(&self) -> &T
where T: Castable, Self: DerivedFrom<T>,

Cast a DOM object upwards to one of the interfaces it derives from.
Source§

fn downcast<T>(&self) -> Option<&T>
where T: DerivedFrom<Self>,

Cast a DOM object downwards to one of the interfaces it might implement.
Source§

impl DomObject for HTMLScriptElement

Source§

type ReflectorType = ()

Source§

fn reflector(&self) -> &Reflector<Self::ReflectorType>

Returns the receiver’s reflector.
Source§

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>>}

Function pointer to the general wrap function type
Source§

impl Drop for HTMLScriptElement

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl HTMLScriptElementMethods<DomTypeHolder> for HTMLScriptElement

Source§

fn Src(&self) -> TrustedScriptURLOrUSVString<DomTypeHolder>

Source§

fn SetSrc( &self, cx: &mut JSContext, value: TrustedScriptURLOrUSVString<DomTypeHolder>, ) -> Fallible<()>

Source§

fn Async(&self) -> bool

Source§

fn SetAsync(&self, value: bool, can_gc: CanGc)

Source§

fn Blocking(&self, cx: &mut JSContext) -> DomRoot<DOMTokenList>

Source§

fn GetCrossOrigin(&self) -> Option<DOMString>

Source§

fn SetCrossOrigin(&self, cx: &mut JSContext, value: Option<DOMString>)

Source§

fn ReferrerPolicy(&self) -> DOMString

Source§

fn InnerText(&self) -> TrustedScriptOrString<DomTypeHolder>

Source§

fn SetInnerText( &self, cx: &mut JSContext, input: TrustedScriptOrString<DomTypeHolder>, ) -> Fallible<()>

Source§

fn Text(&self) -> TrustedScriptOrString<DomTypeHolder>

Source§

fn SetText( &self, cx: &mut JSContext, value: TrustedScriptOrString<DomTypeHolder>, ) -> Fallible<()>

Source§

fn GetTextContent(&self) -> Option<TrustedScriptOrString<DomTypeHolder>>

Source§

fn SetTextContent( &self, cx: &mut JSContext, value: Option<TrustedScriptOrString<DomTypeHolder>>, ) -> Fallible<()>

Source§

fn Supports(_window: &Window, type_: DOMString) -> bool

Source§

fn Type(&self) -> DOMString

Source§

fn SetType(&self, value: DOMString)

Source§

fn Charset(&self) -> DOMString

Source§

fn SetCharset(&self, value: DOMString)

Source§

fn Defer(&self) -> bool

Source§

fn SetDefer(&self, value: bool)

Source§

fn NoModule(&self) -> bool

Source§

fn SetNoModule(&self, value: bool)

Source§

fn Integrity(&self) -> DOMString

Source§

fn SetIntegrity(&self, value: DOMString)

Source§

fn Event(&self) -> DOMString

Source§

fn SetEvent(&self, value: DOMString)

Source§

fn HtmlFor(&self) -> DOMString

Source§

fn SetHtmlFor(&self, value: DOMString)

Source§

fn SetReferrerPolicy(&self, value: DOMString)

Source§

impl HasParent for HTMLScriptElement

Source§

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

Source§

type Parent = HTMLElement

Source§

impl IDLInterface for HTMLScriptElement

Source§

fn derives(class: &'static DOMClass) -> bool

Returns whether the given DOM class derives that interface.
Source§

impl MallocSizeOf for HTMLScriptElement

Source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
Source§

impl MutDomObject for HTMLScriptElement

Source§

unsafe fn init_reflector<Actual>(&self, obj: *mut JSObject)

Initializes the Reflector Read more
Source§

unsafe fn init_reflector_without_associated_memory(&self, obj: *mut JSObject)

Initializes the Reflector without recording any associated memory usage. Read more
Source§

impl PartialEq for HTMLScriptElement

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToJSValConvertible for HTMLScriptElement

Source§

unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)

Convert self to a JSVal. JSAPI failure causes a panic.
Source§

fn safe_to_jsval(&self, cx: &mut JSContext, rval: MutableHandle<'_, Value>)

Convert self to a JSVal. JSAPI failure causes a panic.
Source§

impl Traceable for HTMLScriptElement

Source§

unsafe fn trace(&self, tracer: *mut JSTracer)

Trace self.
Source§

impl VirtualMethods for HTMLScriptElement

Source§

fn children_changed(&self, cx: &mut JSContext, mutation: &ChildrenMutation<'_>)

Source§

fn post_connection_steps(&self, cx: &mut JSContext)

Source§

fn super_type(&self) -> Option<&dyn VirtualMethods>

Returns self as the superclass of the implementation for this trait, if any.
Source§

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, )

Source§

fn unbind_from_tree(&self, _context: &UnbindContext<'_>, _can_gc: CanGc)

Called when a Node is removed from a tree. Implements removing steps: https://dom.spec.whatwg.org/#concept-node-remove-ext
Source§

fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool

Returns true if given attribute attr affects style of the given element.
Source§

fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue

Returns the right AttrValue variant for the attribute with name name on this element.
Source§

fn moving_steps(&self, context: &MoveContext<'_>, can_gc: CanGc)

Source§

fn bind_to_tree(&self, cx: &mut JSContext, context: &BindContext<'_>)

Called when a Node is appended to a tree.
Source§

fn handle_event(&self, event: &Event, can_gc: CanGc)

Called during event dispatch after the bubbling phase completes.
Source§

fn is_valid_command_steps(&self, command: CommandState) -> bool

Source§

fn command_steps( &self, button: DomRoot<HTMLButtonElement>, command: CommandState, can_gc: CanGc, ) -> bool

Source§

fn adopting_steps(&self, cx: &mut JSContext, old_doc: &Document)

Source§

fn pop(&self)

Called on an element when it is popped off the stack of open elements of a parser.
§

impl DerivedFrom<Element> for HTMLScriptElement

§

impl DerivedFrom<EventTarget> for HTMLScriptElement

§

impl DerivedFrom<HTMLElement> for HTMLScriptElement

§

impl DerivedFrom<Node> for HTMLScriptElement

Source§

impl Eq for HTMLScriptElement

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<D, T> DomGlobalGeneric<D> for T
where D: DomTypes, T: DomObject,

Source§

fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>
where Self: Sized,

Returns the [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<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> Filterable for T

Source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> SafeToJSValConvertible for T

Source§

fn safe_to_jsval( &self, cx: JSContext, rval: MutableHandle<'_, Value>, _can_gc: CanGc, )

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ThisReflector for T
where T: DomObject,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T