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 ClassicScriptConstructors
| Name | Description |
|---|---|
| ClassicScript(GlobalScope, string, string) | Creates a classic script. |
ClassicScript(GlobalScope, string, string)
ClassicScript.csCreates a classic script.
public ClassicScript(GlobalScope global, string sourceText, string baseUrl)Parameters
globalGlobalScope- The global object of the realm in which the script runs.
sourceTextstring- The source text of the script.
baseUrlstring- The base URL of the script, used to resolve the module specifiers.
Properties
| Name | Description |
|---|---|
| BaseUrl | 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). |
| Element | Gets the script element whose script this is, or null (e.g. a javascript: URL). |
| FetchOptions | 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. |
| Global | Gets the global object of the realm of the script (the global object of its settings object). |
| MutedErrors | 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.". |
| SourceText | Gets the source text of the script. |
| SourceTextColumn | Gets the column (0-based, in UTF-16 code units) of the start of the source text in its line (see ClassicScript.SourceTextLine). |
| SourceTextLine | 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. |
| Url | 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. |
BaseUrl
ClassicScript.csElement
ClassicScript.csFetchOptions
ClassicScript.csGets 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
Global
ClassicScript.csGets the global object of the realm of the script (the global object of its settings object).
public GlobalScope Global { get; }Property value
MutedErrors
ClassicScript.csGets 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
SourceText
ClassicScript.csSourceTextColumn
ClassicScript.csGets 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
SourceTextLine
ClassicScript.csGets 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; }