Skip to content
ChartForgeX
Class

HtmlExternalAssets

ChartForgeX.Interactivity.Html

Namespace
ChartForgeX.Interactivity.Html
Assembly
ChartForgeX.Interactivity.Html
Modifiers
static

Moves every inline script and style of ChartForgeX HTML into asset files, for pages served under a policy that loads scripts and styles only from files, such as script-src 'self'; style-src 'self'.

Inheritance

  • object
  • HtmlExternalAssets

Remarks

Style attributes become generated cfx-s- classes and, with every style element, move into one stylesheet linked at the end of head (see HtmlStrictStyles). Each executable inline script becomes a script file loaded from the same place in the document, so scripts still run in order and find their position through document.currentScript. Data blocks such as <script type="application/json"> stay inline: browsers never execute them, so the policy does not apply to them. File names carry a content hash, so the runtimes shared by several pages are written once. The graph explorer's physics worker becomes its own file, so the policy needs no blob: source for it.

Methods

public static HtmlExternalPage Split(string html, HtmlAssetReferences assets) #

Splits a ChartForgeX page or fragment into markup without inline scripts or styles and the files it loads.

Parameters

html string required
A page or fragment produced by a ChartForgeX renderer, with or without its own asset references.
assets ChartForgeX.Interactivity.Html.HtmlAssetReferences required
Where the page loads the files from. Write HtmlExternalPage.Files there.

Returns

HtmlExternalPage The markup and the asset files it references.

Fields

public const string StyleSheetAttribute #

The attribute that marks the stylesheet link added for the page's own styles.

Value: data-cfx-external-styles