Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

fix(rootScope, ngRepeat): add support for objects created with Object.create(null) for ngRepeat and $watchCollection #9964

Closed
wants to merge 5 commits into from
Closed

fix(rootScope, ngRepeat): add support for objects created with Object.create(null) for ngRepeat and $watchCollection #9964

wants to merge 5 commits into from

Conversation

HeberLZ
Copy link
Contributor

@HeberLZ HeberLZ commented Nov 7, 2014

Basically, the hasOwnProperty method was being called from an object gotten from the user. When that object was initially created with Object.create(null), it didn't inherit from Object so it didn't have the hasOwnProperty method throwing an "undefined is not a function" error.

This was fixed by executing hasOwnProperty.call(object, key) instead of object.hasOwnProperty(key)

@caitp
Copy link
Contributor

caitp commented Nov 7, 2014

@petebacondarwin do we want this? I feel like we should be steering people away from using non-arrays with ngRepeat. Otherwise, it looks like a good patch. Except for the fact that it's missing tests and is doing a ton of crazy style changes that will probably fail jscs

@HeberLZ
Copy link
Contributor Author

HeberLZ commented Nov 7, 2014

I got an old version of the parse file. I'm updating it right away
El nov 7, 2014 7:50 PM, "Caitlin Potter" notifications@github.com
escribió:

@petebacondarwin https://github.com/petebacondarwin do we want this? I
feel like we should be steering people away from using non-arrays with
ngRepeat. Otherwise, it looks like a good patch. Except for the fact that
it's missing tests and is doing a ton of crazy style changes that will
probably fail jscs


Reply to this email directly or view it on GitHub
#9964 (comment).

@HeberLZ
Copy link
Contributor Author

HeberLZ commented Nov 7, 2014

The reason i proposed this fix is because the application i'm currently working on, is embedded on an external webapp, which mangles around Object.prototype. Because of this, we create all our objects with Object.create(null) so that we don't inherit anything that might break things.
Without these fixes the application throws "undefined is not a function" errors which end up breaking angularjs's workflow.

@caitp
Copy link
Contributor

caitp commented Nov 11, 2014

I guess this is fine, but please add a test case for this, alright?

@caitp caitp added this to the 1.3.x milestone Nov 11, 2014
@HeberLZ
Copy link
Contributor Author

HeberLZ commented Nov 11, 2014

Sure! I'll add them as soon as i'm home
El nov 11, 2014 4:19 PM, "Caitlin Potter" notifications@github.com
escribió:

I guess this is fine, but please add a test case for this, alright?


Reply to this email directly or view it on GitHub
#9964 (comment).

@petebacondarwin
Copy link
Member

I added some tests and landed this for 1.4.x.

@ocombe
Copy link
Contributor

ocombe commented Sep 18, 2015

I guess @HeberLZ never made it home :(

@imcotton
Copy link

@ocombe, I think the man just fine according to his GitHub activity 😌

@HeberLZ
Copy link
Contributor Author

HeberLZ commented Sep 18, 2015

I'm really sorry about this, completely forgot about this pr because at the company i used to work at, we stopped using Object.create(null)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants