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

Dropdown preselection fails for objects with null values #820

Closed
kcaebe opened this issue Aug 31, 2016 · 1 comment
Closed

Dropdown preselection fails for objects with null values #820

kcaebe opened this issue Aug 31, 2016 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@kcaebe
Copy link

kcaebe commented Aug 31, 2016

I have an object with some null properties on it that I am trying to use to preselect an item from a dropdown. This issue is that domhandler.equals() always returns false for an object with null properties. For example if I have 2 objects that look like this:
{name:'Name', exceptionMessage: null, id:0}
domhandler.equals is going to return false because of the exceptionMessage field. This happens because typeof null === object and the switch for object recursively calls domhandler.equals which always returns false for any null value.

cagataycivici added a commit that referenced this issue Sep 1, 2016
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Sep 1, 2016
@cagataycivici cagataycivici added this to the 1.0.0-beta.15 milestone Sep 1, 2016
@cagataycivici cagataycivici self-assigned this Sep 1, 2016
@loic49
Copy link

loic49 commented Sep 25, 2016

I have object with "undefined" properties and the problem still exists.

the problem is on line 313/314 in domhandler.ts

we've got this code :

            for (var p in obj2) {
                if (typeof (obj1[p]) == 'undefined') return false;
            }

But we have to check obj2 property too, because if it's "undefined" too we should not return false. Here what's working for me :

            for (var p in obj2) {
                if (typeof (obj1[p]) == 'undefined' && typeof (obj2[p]) != 'undefined') return false;
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

3 participants