Skip to content
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

fix TODO for VNode::apply for VNode::VRef variant #194

Closed
vitiral opened this issue Apr 9, 2018 · 2 comments · Fixed by #203
Closed

fix TODO for VNode::apply for VNode::VRef variant #194

vitiral opened this issue Apr 9, 2018 · 2 comments · Fixed by #203

Comments

@vitiral
Copy link
Contributor

vitiral commented Apr 9, 2018

Here is the current code:

    /// Virtual rendering for the node. It uses parent node and existend children (virtual and DOM)
    /// to check the difference and apply patches to the actual DOM represenatation.
    fn apply(
        &mut self,
        parent: &Node,
        precursor: Option<&Node>,
        opposite: Option<VNode<Self::Context, Self::Component>>,
        env: ScopeEnv<Self::Context, Self::Component>,
    ) -> Option<Node> {
        match *self {
            VNode::VTag(ref mut vtag) => vtag.apply(parent, precursor, opposite, env),
            VNode::VText(ref mut vtext) => vtext.apply(parent, precursor, opposite, env),
            VNode::VComp(ref mut vcomp) => vcomp.apply(parent, precursor, opposite, env),
            VNode::VList(ref mut vlist) => vlist.apply(parent, precursor, opposite, env),
            VNode::VRef(_) => {
                // TODO use it for rendering any tag
                unimplemented!("node can't be rendered now");
            }
        }
    }

This is making it so that we can't shim arbitrary javascript nodes into yew:

koute/stdweb#196 (comment)

This could offer preliminary support for #143

@vitiral vitiral changed the title fix TODO for VNode::VRef::apply fix TODO for VNode::apply for VNode::VRef variant Apr 9, 2018
This was referenced Apr 9, 2018
vitiral added a commit to vitiral/yew that referenced this issue Apr 10, 2018
@vitiral
Copy link
Contributor Author

vitiral commented Apr 10, 2018

I think I'm missing something -- how are we communicating to javascript that our node is doing anything? I feel like the apply method is doing it with the parent...

@vitiral
Copy link
Contributor Author

vitiral commented Apr 10, 2018

This is related to #189 and makes me at least convinced that it is non-trivial.

bors bot added a commit that referenced this issue Apr 11, 2018
203: add VElement: render arbitrary HTML, including SVG! r=DenisKolodin a=vitiral

This is attempt number 2 for #195 

- fix #194 
- fix #189 

This is _essentially_ `innerHTML` -- allowing the user to inject _any_ `Element` that they have.

Co-authored-by: Garrett Berg <vitiral@gmail.com>
@bors bors bot closed this as completed in #203 Apr 11, 2018
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 a pull request may close this issue.

1 participant