ClassicScript Class

A classic script (https://html.spec.whatwg.org/multipage/webappapis.html#classic-script) that the library asks the ScriptEngine to run: the script of a script element, a javascript: URL, or a string passed to setTimeout() or setInterval().

public sealed class ClassicScript

Constructors

NameDescription
ClassicScript(GlobalScope, string, string)Creates a classic script.

ClassicScript(GlobalScope, string, string)

ClassicScript.cs

Creates a classic script.

public ClassicScript(GlobalScope global, string sourceText, string baseUrl)

Parameters

global GlobalScope
The global object of the realm in which the script runs.
sourceText string
The source text of the script.
baseUrl string
The base URL of the script, used to resolve the module specifiers.

Properties

NameDescription
BaseUrlGets the base URL of the script (https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-base-url): about:blank for a script whose errors are muted (https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-classic-script).
ElementGets the script element whose script this is, or null (e.g. a javascript: URL).
FetchOptionsGets the options used to fetch the modules imported by the script (https://html.spec.whatwg.org/multipage/webappapis.html#descendant-script-fetch-options): the crossorigin and referrerpolicy attributes, the nonce and the parser metadata of its script element, else the default options.
GlobalGets the global object of the realm of the script (the global object of its settings object).
MutedErrorsGets whether the errors of the script are muted (https://html.spec.whatwg.org/multipage/webappapis.html#muted-errors): the script was fetched from another origin without CORS. The library replaces the information of the errors it reports with "Script error.".
SourceTextGets the source text of the script.
SourceTextColumnGets the column (0-based, in UTF-16 code units) of the start of the source text in its line (see ClassicScript.SourceTextLine).
SourceTextLineGets the line (1-based) of the start of the source text in the document of an inline script created by the HTML parser: the locations in the script (e.g. of its errors and of the violations of the content security policies) are the locations in the document. The default value is 1.
UrlGets the URL of the script, used as the file name of the errors and of the stack traces: the URL of an external script, or the URL of the document of an inline script.

Gets the base URL of the script (https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-base-url): about:blank for a script whose errors are muted (https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-classic-script).

public string BaseUrl { get; }

Property value

string

Gets the script element whose script this is, or null (e.g. a javascript: URL).

public Element? Element { get; init; }

Property value

Element?

FetchOptions

ClassicScript.cs

Gets the options used to fetch the modules imported by the script (https://html.spec.whatwg.org/multipage/webappapis.html#descendant-script-fetch-options): the crossorigin and referrerpolicy attributes, the nonce and the parser metadata of its script element, else the default options.

public ModuleFetchOptions FetchOptions { get; init; }

Property value

ModuleFetchOptions

Gets the global object of the realm of the script (the global object of its settings object).

public GlobalScope Global { get; }

Property value

GlobalScope

MutedErrors

ClassicScript.cs

Gets whether the errors of the script are muted (https://html.spec.whatwg.org/multipage/webappapis.html#muted-errors): the script was fetched from another origin without CORS. The library replaces the information of the errors it reports with "Script error.".

public bool MutedErrors { get; init; }

Property value

bool

Gets the source text of the script.

public string SourceText { get; }

Property value

string

SourceTextColumn

ClassicScript.cs

Gets the column (0-based, in UTF-16 code units) of the start of the source text in its line (see ClassicScript.SourceTextLine).

public int SourceTextColumn { get; init; }

Property value

int

SourceTextLine

ClassicScript.cs

Gets the line (1-based) of the start of the source text in the document of an inline script created by the HTML parser: the locations in the script (e.g. of its errors and of the violations of the content security policies) are the locations in the document. The default value is 1.

public int SourceTextLine { get; init; }

Property value

int

Gets the URL of the script, used as the file name of the errors and of the stack traces: the URL of an external script, or the URL of the document of an inline script.

public string Url { get; init; }

Property value

string