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

fixed replaceChild bug #229

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fixed replaceChild bug #229

wants to merge 1 commit into from

Conversation

Gcaufy
Copy link

@Gcaufy Gcaufy commented Jan 24, 2018

// node: <div><slot /></div>
// newChild: Hello World
// oldChild: <slot />

node.replaceChild(newChild, oldChild);

// Expect: <div>Hello World</div>
// Actually: Hello World

But if I added a space befor <slot />, I get the correct result.

// node: <div> <slot /></div>
// newChild: Hello World
// oldChild: <slot />

node.replaceChild(newChild, oldChild);

// Expect: <div> Hello World</div>
// Actually: <div> Hello World</div>

Copy link

@songkeys songkeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It keeps reporting:

TypeError: Cannot read property 'parentNode' of null

Should be:

if (nextChild != null) {
	nextChild.parentNode.firstChild = newFirst;
}else{
	parentNode.firstChild = newFirst;
}

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 this pull request may close these issues.

2 participants