Skip to content

Add reusable SVG JavaScript runtime#519

Merged
wieslawsoltes merged 36 commits into
masterfrom
feature/svg-javascript-runtime
May 1, 2026
Merged

Add reusable SVG JavaScript runtime#519
wieslawsoltes merged 36 commits into
masterfrom
feature/svg-javascript-runtime

Conversation

@wieslawsoltes
Copy link
Copy Markdown
Owner

@wieslawsoltes wieslawsoltes commented Apr 22, 2026

PR Summary: Add Reusable SVG JavaScript Runtime

Title

Add reusable SVG JavaScript runtime

Related Issue

Addresses JavaScript and DOM support requested in issue #422.

Summary

This PR moves the JavaScript and DOM surface into a standalone Svg.JavaScript project, keeps the host boundary reusable, and wires that runtime into Svg.Skia for rendering, hit-testing, animation, and mutation refresh.

The branch now covers the full DOM-focused W3C SVG 1.1 JavaScript slice in this test harness, including animation DOM, path DOM, text DOM, scripted event handling, use instance dispatch, and browser-style geometry APIs. Performance was treated as a hard constraint: text DOM is exposed lazily over the real shaped layout path, animation DOM is integrated into the existing controller instead of adding a second timing engine, and benchmark checks against master stayed flat or better on the affected hot paths.

JavaScript remains opt-in at the library level. Consumers still need to enable it through the relevant shared SKSvgSettings surface or directly on an SKSvg instance. The Avalonia and Uno test apps now enable it by default so the runtime and DOM bridge can be exercised interactively.

What Changed

Standalone Svg.JavaScript Runtime

  • Extracted the reusable runtime into src/Svg.JavaScript.
  • Kept the runtime host-agnostic and pushed renderer-specific behavior into host adapters implemented by Svg.Skia.
  • Expanded the DOM surface substantially:
    • namespace-aware element and attribute APIs
    • stable node wrappers and subtree-scoped lookup
    • text nodes, nodeValue, textContent, innerHTML
    • event listeners and dispatch
    • geometry factories and query APIs
    • animated values for strings, lengths, numbers, lists, transforms, and enumerations
    • path DOM helpers and SVGPathSeg-style fixture support
    • deterministic setTimeout / clearTimeout, including delayed callbacks and function handlers
    • browser-compatible DOMException codes needed by the W3C rows

Animation DOM

  • Added SVGAnimationElement / ElementTimeControl DOM behavior on top of the existing animation controller:
    • beginElement
    • beginElementAt
    • endElement
    • endElementAt
    • getStartTime
  • Extended timing parsing and resolution to support syncbase .begin / .end timing and imperative begin/end scheduling.
  • Added timeline callback dispatch for onbegin / onend and routed those callbacks back through the JavaScript runtime.
  • Preserved performance by caching static timing instances and reusing the controller’s interval resolution instead of rebuilding timing lists every frame.

Text DOM Over Real Layout

  • Added a reusable text-content host boundary from Svg.JavaScript into Svg.Skia.
  • Implemented lazy text DOM metrics over the real shaped layout path rather than the lightweight JS geometry estimator.
  • Added per-character DOM behavior used by the W3C rows:
    • getComputedTextLength
    • getNumberOfChars
    • getSubStringLength
    • getStartPositionOfChar
    • getEndPositionOfChar
    • getExtentOfChar
    • getRotationOfChar
    • getCharNumAtPosition
    • selectSubString
  • Kept the feature lazy and mutation-versioned so documents that never touch text DOM pay no extra permanent scene-graph cost.

Svg.Skia Integration

  • Added or extended host wiring for:
    • JavaScript runtime initialization
    • inline and external script execution
    • root onload
    • DOM mutation refresh
    • event listener dispatch
    • scene-graph-backed geometry queries
    • animation timeline integration
    • use instance target routing
  • Added RefreshFromSourceDocument() to rebuild rendered output after source-DOM mutation where needed.
  • Added reusable SKSvgSettings.CopyTo() / Clone() helpers and reused them from SKSvg.Clone() so JavaScript, timeout, external-script, font, viewport, and color settings stay consistent whenever settings are copied.

Control Settings Propagation And Samples

  • Propagated shared SKSvgSettings into every SKSvg created by Svg.Controls.Skia.Avalonia.SvgSource:
    • file loads
    • stream / inline SVG loads
    • SvgDocument loads
  • Propagated shared SKSvgSettings into every SKSvg created by Uno.Svg.Skia.SvgSource through the same load paths.
  • Added shared SkiaModel settings surfaces for SvgML Avalonia, Uno, and MAUI inline controls, then applied those settings before each generated control load.
  • Enabled JavaScript by default in:
    • samples/TestApp
    • samples/UnoTestApp
  • Added focused regression coverage proving shared JavaScript settings execute DOM mutations in Avalonia and Uno source loaders.

CSS / Raw Value / Compatibility Behavior

  • Preserved raw DOM-facing values needed by animated wrappers and script-driven attribute access.
  • Fixed compatibility CSS reapplication after DOM mutations so selector-driven styling stays correct across:
    • inline style edits
    • direct style attribute replacement/removal
    • class/id mutations that affect selectors outside the mutated subtree
  • Fixed style fallback restoration so removing inline overrides exposes the updated underlying presentation value instead of stale state.

W3C Harness And Baselines

  • Extended the Chrome capture script so overrides can reproduce animation seek times and scripted interactions over HTTP.
  • Added fresh Chrome override captures for the browser-sensitive DOM rows added in this branch.
  • Used semantic assertions for rows where modern Chrome is not a valid oracle anymore, instead of forcing the renderer toward stale image baselines.
  • Fixed the struct-dom-13-f getIntersectionList() root-node assertion by filtering the W3C draft watermark overlay only for W3C suite fixtures, while preserving normal application documents that use a draft-watermark group.

W3C DOM Coverage

This branch turns on the remaining DOM-focused W3C rows exercised by the JavaScript runtime in this suite, including:

  • animation DOM:
    • animate-dom-01-f
    • animate-dom-02-f
    • animate-script-elem-01-b
  • event / interaction DOM:
    • interact-dom-01-b
    • script-handle-01-b
    • script-handle-02-b
    • script-handle-03-b
    • script-handle-04-b
  • path / geometry DOM:
    • paths-dom-01-f
    • paths-dom-02-f
    • struct-dom-12-b
  • text / SVG DOM:
    • svgdom-over-01-f
    • text-dom-01-f
    • text-dom-02-f
    • text-dom-03-f
    • text-dom-04-f
    • text-dom-05-f
  • previously enabled DOM/runtime rows remain covered:
    • coords-dom-01-f through coords-dom-04-f
    • masking-path-09-b
    • masking-path-12-f
    • script-specify-02-f
    • struct-dom-06-b
    • struct-dom-07-f
    • struct-dom-13-f
    • struct-dom-16-f
    • struct-dom-17-f
    • struct-dom-18-f
    • struct-dom-19-f
    • struct-dom-20-f
    • struct-svg-01-f
    • struct-use-13-f
    • struct-use-14-f
    • struct-use-15-f
    • types-dom-06-f
    • types-dom-08-f

Current DOM-focused W3C filter state on this branch:

  • 47 passed
  • 0 skipped

The only JavaScript-related W3C row still explicitly skipped in this area is script-specify-01-f, because the legacy baseline is stale and current Chrome is not a valid oracle for its obsolete contentScriptType behavior.

Perf Validation

Performance and memory usage were treated as release gates for this work.

Animation Benchmarks vs master

  • AdvanceLayeredFrame 64/4: 273 us vs 283 us
  • AdvanceLayeredFrame 64/16: 1.495 ms vs 1.509 ms
  • AdvanceLayeredFrame 256/4: 946 us vs 1.104 ms
  • AdvanceLayeredFrame 256/16: 4.800 ms vs 4.664 ms

The only slight regression case was the highest-density 256/16 run, and it stayed within normal short-run variance. The meaningful regression that showed up earlier during development was removed before landing this branch.

Text Benchmarks vs master

  • text compile and text asset-loader benchmarks stayed effectively flat, roughly within +/-1%

Verification

Validated on this branch with:

dotnet format Svg.Skia.slnx --no-restore
dotnet build Svg.Skia.slnx -c Release --no-restore
dotnet test Svg.Skia.slnx -c Release --no-restore
dotnet build src/SvgML.Maui/SvgML.Maui.csproj -c Release -f net10.0-maccatalyst
dotnet build samples/UnoTestApp/UnoTestApp.csproj -c Release --no-restore
dotnet test tests/Svg.Controls.Skia.Avalonia.UnitTests/Svg.Controls.Skia.Avalonia.UnitTests.csproj -c Release --no-restore --filter "FullyQualifiedName~SvgSourceTests"
dotnet test tests/Svg.Controls.Skia.Uno.UnitTests/Svg.Controls.Skia.Uno.UnitTests.csproj -c Release --no-restore --filter "FullyQualifiedName~SvgSourceTests"
dotnet test tests/Svg.Skia.UnitTests/Svg.Skia.UnitTests.csproj -f net10.0 -c Release --no-restore --filter "FullyQualifiedName~SKSvgSettingsTests"
dotnet test tests/Svg.Skia.UnitTests/Svg.Skia.UnitTests.csproj -f net10.0 -c Release --no-restore --filter "FullyQualifiedName~W3CTestSuiteTests.Tests&DisplayName~dom-"
dotnet test tests/Svg.Skia.UnitTests/Svg.Skia.UnitTests.csproj -f net10.0 -c Release --no-restore --filter "FullyQualifiedName~SvgJavaScriptRuntimeTests.Runtime_IntersectionList_KeepsApplicationDraftWatermarkGroups|FullyQualifiedName~SvgJavaScriptRuntimeTests.Load_StructDom13Fixture_AppendsPassedVerificationRows|FullyQualifiedName~SvgJavaScriptRuntimeTests.Runtime_CheckIntersection_UsesHiddenRenderableGeometry"
dotnet test tests/Svg.Skia.UnitTests/Svg.Skia.UnitTests.csproj -f net10.0 -c Release --no-restore --filter "FullyQualifiedName~W3CTestSuiteTests.Tests&DisplayName~struct-dom-13-f"
dotnet run -c Release --project tests/Svg.Skia.Benchmarks/Svg.Skia.Benchmarks.csproj -- --filter "*AdvanceLayeredFrame*"
git diff --check

Additional focused runtime coverage was added for:

  • delayed setTimeout ordering and clearTimeout
  • animation DOM ElementTimeControl semantics
  • getStartTime invalid-state behavior
  • text DOM per-character metrics and hit-testing
  • shared settings copy and clone behavior
  • shared JavaScript settings propagation through Avalonia and Uno SvgSource
  • paths-dom-01-f / paths-dom-02-f
  • svgdom-over-01-f
  • semantic verification for stale image-oracle rows such as struct-dom-07-f, struct-dom-13-f, and struct-dom-18-f
  • struct-dom-13-f document-root getIntersectionList() length behavior with the W3C draft watermark overlay present

Commit Breakdown

Recent branch-top commits:

  1. Fix W3C DOM intersection list watermark
  2. Enable JavaScript in Uno test app
  3. Propagate SVG settings in SvgML controls
  4. Propagate shared settings in Skia SVG sources
  5. Add reusable SVG settings copy helpers
  6. Address JavaScript DOM review comments
  7. Add W3C DOM performance implementation plan
  8. Enable JavaScript in the test app
  9. Enable W3C DOM fixtures and captures
  10. Add DOM animation and text runtime support

Earlier foundation commits on the same PR established the standalone runtime extraction, parser/raw-value support, initial host integration, CSS compatibility fixes, broader DOM/runtime APIs, and the first wave of W3C coverage.

Risk And Follow-Up

  • This is still an SVG-focused DOM/runtime subset, not a full browser implementation.
  • The runtime is intentionally opt-in for library consumers because scripts can mutate documents and execute external content when explicitly enabled. The test apps opt in for interactive diagnostics.
  • The main remaining follow-up in this area is broader browser-event coverage outside the current W3C DOM slice, not the DOM rows covered by this PR.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f597c51f36

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptElement.cs Outdated
Comment thread src/Svg.Skia/SKSvg.Model.cs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cab4e698fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.Skia/SKSvg.Model.cs
Comment thread src/Svg.Skia/SKSvg.Model.cs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef65638484

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.Custom/Compatibility/SvgDocument.DynamicStyles.cs Outdated
Comment thread src/Svg.Custom/Compatibility/SvgCssCompatibilityProcessor.cs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ee7479c3a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.Skia/SKSvg.Model.cs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d85e7a69f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptPathDom.cs Outdated
Comment thread src/Svg.Animation/Animation/SvgAnimationController.cs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f1d684fac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptPathDom.cs Outdated
Comment thread src/Svg.Skia/SKSvg.Model.cs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ebac8ff08e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptRuntime.cs Outdated
Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptRuntime.cs Outdated
Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptElement.cs
Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptDocument.cs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7bacb8c296

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptElement.cs
Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptElement.cs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f0b452b7d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptElement.cs Outdated
Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptElement.cs Outdated
Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptPathDom.cs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1b7c014606

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptElement.cs
Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptElement.cs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f182408830

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptRuntime.cs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ec0f73c96

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptDocument.cs Outdated
Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptDocument.cs Outdated
Comment thread src/Svg.JavaScript/Scripting/SvgJavaScriptDocument.cs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f38058bdf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Svg.Skia/Interaction/SvgInteractionDispatcher.cs Outdated
Comment thread src/Svg.Skia/SKSvg.Model.cs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ef76f1694

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

foreach (var element in BuildRoute(target))
{
animationFrameDirty |= svg?.RecordAnimationPointerEvent(element, eventType) == true;
var javaScriptResult = svg?.DispatchJavaScriptEvent(element, target, relatedElement, ToJavaScriptEventType(svgEventName), svgEventName, input, ref javaScriptEvent);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Dispatch JS capture listeners in pointer tunnel phase

Routed pointer events currently invoke JavaScript only in the target-to-root loop (svg.DispatchJavaScriptEvent(...)), while the tunnel pass (DispatchTunnelEvent) does not execute JavaScript listeners. In practice, listeners registered with addEventListener(..., true) never run for real pointer input (click/move/up/down), even though capture works for dispatchEvent, so capture-dependent handlers silently break in interactive scenarios.

Useful? React with 👍 / 👎.

}

var nodes = new List<ISvgNode>(element.Children.Count * 2);
nodes.Add(new SvgContentNode { Content = "\n" });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove synthetic newline nodes from use instance trees

GetChildNodes injects artificial "\n" text nodes when an element has multiple children but no explicit Nodes. That fabricates DOM children that were never present in the referenced content, so <use> instance traversal (firstChild, childNodes, sibling/index-based logic) can observe extra text nodes and incorrect ordering.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 866719d5a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +602 to 605
InitializeJavaScriptRuntime(svgDocument);
InvalidateRetainedSceneGraph();

var animationController = new SvgAnimationController(svgDocument);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Attach animation host before executing document scripts

LoadSvgDocument runs InitializeJavaScriptRuntime(svgDocument) before creating/replacing the new SvgAnimationController, and InitializeJavaScriptRuntime executes <script>/onload immediately. In that phase runtime.AnimationHost is still null, so animation DOM calls like beginElement()/beginElementAt() are dropped (SvgJavaScriptRuntime.BeginElement is a null-conditional no-op), which causes load-time script-driven animations to fail to start or schedule correctly.

Useful? React with 👍 / 👎.

Comment on lines +263 to +266
var eventType = NormalizeEventType(evt.type);
if (string.IsNullOrWhiteSpace(eventType))
{
return true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Throw on dispatchEvent when event type is uninitialized

DispatchEventCore treats an empty/whitespace event type as a successful dispatch and returns true, but this should be an invalid-state error for uninitialized events (for example, document.createEvent('Event') dispatched without initEvent). Returning success masks script errors and diverges from DOM behavior expected by callers that rely on the exception path.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant