-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Namespaced properties don't seem to work #13
Comments
hmm, it should, see this example: https://github.com/nthtran/vdom-to-html/blob/master/test/test.js#L199 try putting the |
I tried another test and it works, so the issue is on my side. Cheers! |
I can get it working by installing vdom-to-html directly, if I npm link my development copy it doesn't work. At least I know it will work when it's live! |
That's strange. What did you change in your development copy? |
@nthtran Unfortunately, nothing at all! It's odojs/vdom-to-html@master |
@nthtran I worked out what the issue is. The code checks with instanceof which fails if I created the vdom with a different version of virtual-dom to the version vdom-to-html includes. // instanceof doesn't work if the hooks were created by a different version of virtual-dom
if (value instanceof softHook || value instanceof attrHook) {
ret += ' ' + createAttribute(name, value.value, true);
continue;
} It this something vdom-to-html should support? It might be nice if I don't have to rely on using exactly the same virtual-dom package. Could we write an 'is-attribute-hook' boolean function? Attributes have a type property that is equal to 'AttributeHook'. To be complete it might make sense to also write a check for SoftSetHook, unfortunately that doesn't have a type property on it's prototype. To allow vdom-to-html to operate on vdom structures created from a different version of virtual-dom we could:
Actions 1 and 2 require changes to virtual-dom. Let me know if you like this direction and I'll go ahead and put in a pull request to virtual-dom. |
What you proposed makes sense. If |
I've had a look and there is an is-hook check. As I see it we have a few options:
Option 1 is the easiest, Option 2 is more correct and Option 3 is probably too verbose for virtual-dom. Thoughts? |
I've submitted a PR for Option 2 that also discusses Option 3. |
Nice work 👍. I also like Option 2 better so hope that'll get merged. |
I'd personally go with |
… with certain versions of virtual-dom (ntharim/vdom-to-html#13). I'm still working on handling that.
This reverts commit 3717976. See ntharim/vdom-to-html#13.
This reverts commit bafc5db. See ntharim/vdom-to-html#13.
The vdom structure:
Renders fine in the browser but vdom-to-html outputs
<svg><use></use></svg>
Let me know if I can help!
The text was updated successfully, but these errors were encountered: