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

IE: An extra object in data.children in ObjectLoader.parseObject #11432

Closed
2 of 13 tasks
LebedenkoN opened this issue Jun 2, 2017 · 4 comments
Closed
2 of 13 tasks

IE: An extra object in data.children in ObjectLoader.parseObject #11432

LebedenkoN opened this issue Jun 2, 2017 · 4 comments

Comments

@LebedenkoN
Copy link
Contributor

LebedenkoN commented Jun 2, 2017

The problem occure while parsing json file for userDefined model. In ObjectLoader.parseObject in Internet Explorer while iterating over children there is an extra child "includes".
for ( var child in data.children ) { object.add( this.parseObject( data.children[ child ], geometries, materials ) ); }

Three.js version
  • Dev
  • r85
  • ...
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
LebedenkoN added a commit to LebedenkoN/three.js that referenced this issue Jun 2, 2017
…-in-data.children-in-ObjectLoader.parseObject

Updated Objectoader.parseObject. Changed the way of iterating over data.children array mrdoob#11432
@Flur
Copy link

Flur commented Jun 2, 2017

That would be great! 👍

@mrdoob
Copy link
Owner

mrdoob commented Jun 2, 2017

Where does "includes" come from?

@makc
Copy link
Contributor

makc commented Jun 2, 2017

probably for...in uses larger set of keys than just numbers, includes is probably array's method name

@LebedenkoN
Copy link
Contributor Author

@mrdoob "includes" come from Array.prototype, and for avoiding this kind of issue there can be two ways:

  • add checking for hasOwnProperty:
    for ( var child in data.children ) {
    if (data.children.hasOwnProperty(child)) object.add( this.parseObject( data.children[ child ], geometries, materials ) );
    }
    but this fix can slow down the iteration over array in cases when data.children.length is quite big

  • resolving this issue as I have suggested in Pull Request

mrdoob added a commit that referenced this issue Jul 6, 2017
IE: An extra object in data.children in ObjectLoader.parseObject #11432
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

4 participants