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

[check package] Object can't have the "nodeType" property #7354

Closed
lukejagodzinski opened this issue Jul 4, 2016 · 2 comments
Closed

[check package] Object can't have the "nodeType" property #7354

lukejagodzinski opened this issue Jul 4, 2016 · 2 comments

Comments

@lukejagodzinski
Copy link

@lukejagodzinski lukejagodzinski commented Jul 4, 2016

Because of this line https://github.com/meteor/meteor/blob/devel/packages/check/isPlainObject.js#L36 it is not possible to check existence of the nodeType property. It treats it as non plain object. The following code will not work.

const pattern = Match.ObjectIncluding({ nodeType: Match.Any });
check({ nodeType: 'asd' }, pattern);
// Throws "Match error: Expected plain object"
@hwillson
Copy link
Member

@hwillson hwillson commented Jan 30, 2017

The current isPlainObject function in the check package was extracted from jquery 1.11.2, to remove the check packages dependency on jquery. Modern versions of jquery's isPlainObject function do not have the nodeType issue mentioned in this issue thread (example). We can likely just drop a copy of jquery's updated isPlainObject function into the check package (after massaging it a bit and adding some additional tests), and be good to go on this one.

abernix added a commit that referenced this issue Feb 15, 2017
To document the updating of the `jQuery.isPlainObject` for #7354.
@abernix
Copy link
Member

@abernix abernix commented Feb 15, 2017

check@1.2.5 was just published with the fix submitted in #8351. Thanks for reporting this originally, @jagi, thanks to @hwillson for the analysis and thanks @nlhuykhang for the fix! Great cooperation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants