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

Comments

Projects
None yet
3 participants
@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

This comment has been minimized.

Member

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

Add `History.md` entry about updating `check` package.
To document the updating of the `jQuery.isPlainObject` for #7354.
@abernix

This comment has been minimized.

Member

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!

@abernix abernix closed this Feb 15, 2017

abernix added a commit that referenced this issue Mar 1, 2017

Add `History.md` entry about updating `check` package.
To document the updating of the `jQuery.isPlainObject` for #7354.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment