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
Labels
confirmed We want to fix or implement it Project:Utilities Type:Bug

Comments

@lukejagodzinski
Copy link
Contributor

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"
@abernix abernix added confirmed We want to fix or implement it Project:Utilities Type:Bug labels Jul 4, 2016
@hwillson
Copy link
Contributor

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
Contributor

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
Labels
confirmed We want to fix or implement it Project:Utilities Type:Bug
Projects
None yet
Development

No branches or pull requests

3 participants