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 nodelist readonly length #349

Merged
merged 5 commits into from
Feb 7, 2019

Conversation

larrybotha
Copy link
Contributor

When running Two.js in an environment where use strict; is used, setting childNodes.length to anything throws an error because it's actually a read-only property.

Also, childNodes is live, so updates to the DOM will be reflected in the length property automatically.

All tests are passing with this update.

childNodes.length is readonly, and is also updated live when the DOM is updated. See:
https://developer.mozilla.org/en-US/docs/Web/API/NodeList

In strict mode attempting to set `childNodes.length` throws an error.
@jonobr1
Copy link
Owner

jonobr1 commented Feb 7, 2019

Thanks! We still need to remove all the children from the gradient tag though. I'll update your PR to handle that.

@larrybotha
Copy link
Contributor Author

haha, ye, I was just about to say hang on a second... I've got a failing case that's not yet tested. Still evaluating the issue... but looks like a gradient is not being applied.

Will follow up once I figure out what's going on.

@jonobr1
Copy link
Owner

jonobr1 commented Feb 7, 2019

I think it should work now. But, if there are additional things you want to add I'll wait to merge. Thanks for the PR!

@larrybotha
Copy link
Contributor Author

cool, I'm gonna merge these changes back into my branch, and see what's going on with the issue I'm experiencing in my project. Hopefully a quick fix, but I'll likely get back to you tomorrow :)

@larrybotha
Copy link
Contributor Author

alright, your commits fixed my issues! Good to go to merge. Thanks @jonobr1

@jonobr1 jonobr1 merged commit f90fcab into jonobr1:dev Feb 7, 2019
@larrybotha larrybotha deleted the fix-nodelist-readonly-length branch February 8, 2019 07:30
elShiaLabeouf pushed a commit to elShiaLabeouf/two.js that referenced this pull request Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants