Comments (5)
This uncovers an issue: all the tags in <iframe></iframe> should be created with the SVG namespace
Thanks for bringing this up!
The problem is h
is invoked for the most nested elements first, going from the bottom of the tree upwards. That's why we can't do what Preact does, encounter <svg>
element and enable isSVG
, which would use SVG namespace for all children.
Not sure right now how to work around this.
from dom-chef.
Until there's a solution, dom-chef
could use svg-tag-names
and just exclude tags that are also html tags, like iframe
and a
. It wouldn't count as full SVG support, but still better than nothing.
from dom-chef.
Added more tags using svg-tag-names
module via e2f07ae.
from dom-chef.
A solution would to have h
create a vDOM tree as an IR, with a wrapper function called to materialize the DOM.
const el = domify(<svg><iframe></iframe></svg>);
where domify()
propagates the NS from the root to the leafs.
from dom-chef.
I don't think this can be further resolved and probably it's fine. <iframe>
works even without the SVG namespace.
Since babel-plugin-transform-react-jsx
creates nested calls, h('iframe')
won't know it's a child of h('svg')
until the latter is created, and we can't safely correct the NS of the iframe once that happens.
The only way to support this would be by changing the babel transform to something that can be parsed at once, like JSX-IR, but really at that point it's best to just go with #7 (comment)
React either ignores this issue or is able to correct the NS before actually generating the dom because it has total control over it.
from dom-chef.
Related Issues (20)
- Add support for boolean attributes HOT 3
- Accept plain strings as style HOT 1
- Improve TypeScript types for JSX HOT 11
- Add support for `htmlFor`
- Skip undefined attributes
- Skip `null` attributes
- Skip children that aren't Nodes, strings, or numbers
- Add support for dashed event types via `on` attributes HOT 3
- Turn into real ESM module and write in TypeScript
- Support <Function>
- Support new `React.jsx()` syntax
- Improve TypeScript documentation HOT 1
- Feature. Add jsx/jsxs exports for babel automatic runtime HOT 1
- Fix type:module support
- Add support for CSS Custom Properties (variables) via `style` attribute HOT 1
- Support camelCase props
- Pass props to child components? HOT 4
- Add `"sideEffects": false` to `package.json` HOT 1
- Pass attributes to create HOT 3
- onClick and others have incorrect function signature
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dom-chef.