Support `.ownerMathElement` (or something akin to it)
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 56
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
Hopefully this is the correct place for such a request, let me know if not!
I'm looking to add support for rendering MathML elements w/ the correct namespace in Preact, but an issue I'm running up against is that it's quite challenging for us to figure out the namespace an element currently lives in. For a (rough & a bit silly) example:
<math>
{condition ? <mi>1</mi> : <mo>2</mo>}
</math>
During the first rendering pass, we're able to keep track of the namespace as we delve into the children of <math>, however, when condition changes at some point in the future, we need to figure out the namespace before creating whichever element we're swapping to. This poses a bit of a challenge with the existing API.
With SVGs, we use .ownerSVGElement !== undefined which is pretty effective. Unfortunately, modern MathML doesn't seem to have an equivalent we could use, though it looks like MathML 2 supported this.
Is this by chance something worth supporting? Not quite sure yet how we can work around this as we have quite tight perf & size limitations.
Edit: We can use .namespaceURI to determine the existing namespace, but this is a bit less than ideal.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue points to Preact's src/render.js and its ownerSVGElement check; start there and compare it with the namespaceURI behavior described in the issue. A completed change would require a defined MathML namespace-detection API or equivalent and agreement on scope, but the request names no target file or test.
Written by the indexing model from the issue text.
Assessment
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100