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

Insertion order issue when performing a merge with an extra node #228

Closed
agubler opened this issue Jan 21, 2019 · 0 comments

Comments

@agubler
Copy link
Member

commented Jan 21, 2019

Bug

Nodes are merged in the wrong order when the client renders an extra node in between the HTML that is being merged against.

Code

<body>
    <div id="root">
        <div>
            <header></header>
            <footer></footer>
        </div>
    </div>
</body>
class MyWidget extends WidgetBase {
    render() {
        return v('div', [
            v('header', { id: 'header' }),
            v('div' { id: 'my-body' }),
            v('footer' { id: 'footer' })
        ]);
    }
}
// main.ts

const r = renderer(() => w(MyWidget, {});
r.mount({ domNode: document.getElementById('root')! });

Expected behavior:

Node Structure:

<body>
    <div id="root">
        <div>
            <header id="header"></header>
            <div id="my-body"></div>
            <footer id="footer"></footer>
        </div>
    </div>
</body>

Actual behavior:

Node structure:

<body>
    <div id="root">
        <div>
            <header id="header"></header>
            <footer id="footer"></footer>
            <div id="my-body"></div>
        </div>
    </div>
</body>

Package Version: 5.0.0-alpha.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.