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

Error: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. #542

Closed
justinbmeyer opened this issue Jun 12, 2018 · 1 comment

Comments

@justinbmeyer
Copy link
Contributor

justinbmeyer commented Jun 12, 2018

it seems there is an ordering problem with the patcher. The following test fails with an error:

node.js:78 Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

QUnit.test("if within an each", function(){
    var template = stache(`<div>
    	{{# each(sortedMonthlyOSProjects ) }}
    		{{# if(val) }}
    			<span>Hi</span>
    		{{/ if }}
    	{{/ each }}
    	</div>`);

    var osProject1 = {
        val: new SimpleObservable()
    },
        osProject2 = {
            val: new SimpleObservable()
        };
    var calls = 0;

    var sortedMonthlyOSProjects = new Observation(function(){
        osProject1.val.get();
        //osProject2.val.get();
        calls++;
        if(calls % 2 === 0) {
            return [osProject1, osProject2];
        } else {
            return [osProject2, osProject1];
        }
    });

    var frag = template({sortedMonthlyOSProjects: sortedMonthlyOSProjects});

    queues.log();

    osProject1.val.set(true);
    //osProject2.val.set(false);

});
@justinbmeyer
Copy link
Contributor Author

So this is a problem with can-view-live.html. I changed it to update the DOM in the DOM-UI queue. But it changes the nodeList immediately.

The nodeList and HTML should be changed at the same time. All nodeLists should also be changed in the DOM-UI queue.

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

No branches or pull requests

1 participant