🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@timmywil
Copy link
Member

@timmywil timmywil commented Mar 3, 2016

Fixes gh-2968


// The use case that we want to match
assert.ok( jQuery.isPlainObject( {} ), "{}" );
assert.ok( jQuery.isPlainObject( new Object() ), "new Object" ); // jshint ignore:line
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why jshint comment there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of new Object(), I guess. Is that test necessary considering that it's equivalent to {} if one doesn't modify Object.prototype which we don't support?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new window.Object? If we talking about the same thing? jshint ignore:line is bit radical, it seems we should disable the rule, not the whole thing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that new window.Object() does work! Didn't even know why would jshint highlight that - just pointed in the sky and made it rain i guess :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which a jshint bug of course :)

@markelog
Copy link
Member

markelog commented Mar 4, 2016

It seems Object.assign belongs in its own test with possible skip, i would go further though, and move them all in different QUnit.test, like this one is even an asyncTest which doesn't make sense for these one liners i think

// |obj| is a plain object, created by {} or constructed with new Object
return true;
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's clever!

@timmywil timmywil closed this in 00575d4 Mar 7, 2016
@timmywil timmywil deleted the plain branch March 7, 2016 16:13
timmywil added a commit that referenced this pull request Mar 7, 2016
timmywil added a commit that referenced this pull request Mar 7, 2016
@markelog
Copy link
Member

fixup! add test for object containing an object

Nice

markelog added a commit that referenced this pull request Mar 12, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants