HtmlExternalAssets
ChartForgeX.Interactivity.Html
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
- A page or fragment produced by a ChartForgeX renderer, with or without its own asset references.
- assets ChartForgeX.Interactivity.Html.HtmlAssetReferences
- Where the page loads the files from. Write HtmlExternalPage.Files there.
Inherited Methods
Fields
public const string StyleSheetAttribute #The attribute that marks the stylesheet link added for the page's own styles.
data-cfx-external-styles