Skip to content

Conversation

@canadaduane
Copy link
Contributor

This PR is a sample PR introducing the concept of a call to createElementNS (via createSVGElement). This allows SVG elements to be rendered in DLight.

Context:

  • currently, DLight does not support SVG. Elements such as svg are created using the default createElement function, which is HTML-only. They are ignored by the browser, and no SVG is rendered.

Exploration questions:

  • is it sufficient to add all SVG element tag names to a defaultSVGTags set? what about tags that exist in both namespaces (e.g. a, title, script, font etc.)
  • perhaps detecting if a tag is a child of an SVG element tag should automatically cause DLight to tag it as belonging to the SVG namespace?
  • more broadly: What is the most elegant and dX-friendly way of making SVG work in DLight?

@codesandbox
Copy link

codesandbox bot commented Jan 25, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@canadaduane canadaduane changed the base branch from main to chore/release-1-0-0 January 26, 2025 06:23
@canadaduane canadaduane changed the base branch from chore/release-1-0-0 to main February 1, 2025 00:34
This PR is a sample PR introducing the concept of a call to
createElementNS (via createSVGElement). This allows SVG elements to be
rendered in DLight.

Current limitations:
- only works with `svg` and `circle` elements

Future questions:
- would it be possible to add all SVG element tag names to a
defaultSVGTags set? what about tags that exist in both namespaces (e.g.
`a`, `title`, `script`, `font` etc.)
- perhaps detecting if a tag is a child of an SVG element tag should
automatically cause DLight to tag it as belonging to the SVG namespace?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants