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

assert: fix _deepEqual and improve assert.md #11128

Closed
wants to merge 2 commits into from

Conversation

joyeecheung
Copy link
Member

@joyeecheung joyeecheung commented Feb 2, 2017

This is the more semver-patch part of #10282.

Fix _deepEqual

Refactors _deepEqual and fixes a few code paths that lead to
behaviors contradicting what the doc says. Before this commit
certain types of objects (Buffers, Dates, etc.) are not checked
properly, and can get away with different prototypes AND different
enumerable owned properties because _deepEqual would jump to
premature conclusion for them.

Since we no longer follow CommonJS unit testing spec,
the checks for primitives and object prototypes are moved
forward for faster failure.

Improve regexp and float* array checks:

  • Don't compare lastIndex of regexps, because they are not
    enumerable, so according to the docs they should not be compared
  • Compare flags of regexps instead of separate properties
  • Use built-in tags to test for float* arrays instead of using
    instanceof

Refs: #10282 (comment)
Refs: #10258 (comment)

Improve documentation

Use the term "Abstract Equality Comparison" and "Strict Equality
Comparison" from ECMAScript specification to refer to the operations
done by == and ===, instead of the informal
"equal comparison operator" and "strict equality operator".

Clarify that deep strict comparisons checks [[Prototype]]
property, instead of the vague "object prototypes".

Suggest using Object.is() to avoid the caveats of +0, -0 and NaN.

Add a MDN link explaining what enumerable "own" properties are.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

test, assert, doc

@nodejs-github-bot nodejs-github-bot added the assert Issues and PRs related to the assert subsystem. label Feb 2, 2017
@joyeecheung joyeecheung changed the title assert: refactor assert and improve assert.md assert: refactor _deepEqual and improve assert.md Feb 2, 2017
@joyeecheung joyeecheung changed the title assert: refactor _deepEqual and improve assert.md assert: fix _deepEqual and improve assert.md Feb 2, 2017
@joyeecheung joyeecheung added doc Issues and PRs related to the documentations. test Issues and PRs related to the tests. labels Feb 2, 2017
@joyeecheung
Copy link
Member Author

joyeecheung commented Feb 2, 2017

@mscdex mscdex removed doc Issues and PRs related to the documentations. test Issues and PRs related to the tests. labels Feb 2, 2017
@jasnell jasnell added the semver-major PRs that contain breaking changes and should be released in the next major version. label Feb 2, 2017
@joyeecheung
Copy link
Member Author

Benchmarks results (benchmarks taken from #11092). Note that this implementation favors fast failures, though failures are not benchmarked(when an assertion fails the process should probably be terminated anyway).

see results
                                                                                                  improvement confidence      p.value
 assert/deepequal-buffer.js method="nonstrict" len=100 n=1000                                        -92.69 %        *** 1.398352e-10
 assert/deepequal-buffer.js method="strict" len=100 n=1000                                           -87.27 %        *** 8.988908e-07
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="array"          0.52 %            5.671380e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="boolean"        1.33 %            3.162478e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="new-array"      1.39 %          * 2.256608e-02
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="null"           1.12 %            1.546353e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="number"        -0.52 %            7.352546e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="object"        -0.53 %            5.363293e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="string"         0.48 %            5.514581e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="undefined"      0.70 %            2.601707e-01
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="array"             0.59 %            4.341103e-01
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="boolean"           1.73 %         ** 9.211000e-03
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="new-array"         1.30 %            1.185455e-01
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="null"              0.68 %            3.269869e-01
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="number"           -2.51 %            5.382094e-02
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="object"            2.23 %            8.626440e-02
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="string"            0.20 %            7.698036e-01
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="undefined"         0.86 %            3.789055e-01
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="array"                 6.32 %        *** 4.516185e-04
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="boolean"               9.25 %        *** 8.115494e-05
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="new-array"             9.36 %        *** 7.678773e-05
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="null"                  9.41 %        *** 2.294144e-04
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="number"                5.07 %          * 3.376728e-02
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="object"                4.23 %            1.091126e-01
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="string"                6.42 %        *** 5.440464e-04
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="undefined"             8.15 %         ** 4.303777e-03
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="array"                    6.60 %          * 1.017124e-02
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="boolean"                  8.82 %        *** 6.257818e-05
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="new-array"               11.13 %        *** 6.845735e-04
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="null"                     8.88 %        *** 1.083174e-04
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="number"                   4.29 %            2.310841e-01
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="object"                   7.70 %        *** 2.296652e-04
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="string"                   9.81 %        *** 1.067824e-06
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="undefined"               13.05 %        *** 1.293929e-05
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Float32Array"                0.45 %            6.665986e-01
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Float64Array"                1.62 %            1.182916e-01
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Int16Array"                -98.85 %        *** 6.838162e-11
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Int32Array"                -98.02 %        *** 1.541802e-11
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Int8Array"                 -99.33 %        *** 1.169792e-12
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint16Array"               -98.88 %        *** 1.836848e-11
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint32Array"               -97.99 %        *** 7.248263e-13
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint8Array"                -99.32 %        *** 3.145163e-11
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint8ClampedArray"         -99.30 %        *** 5.984442e-12
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Float32Array"                   0.78 %            4.221460e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Float64Array"                  -0.08 %            9.232714e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Int16Array"                    -6.42 %            7.496064e-02
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Int32Array"                    -0.20 %            9.728131e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Int8Array"                     -5.38 %            5.518969e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint16Array"                   -6.58 %            2.480984e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint32Array"                   -4.62 %            1.772045e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint8Array"                   -10.72 %        *** 1.283864e-04
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint8ClampedArray"             -0.45 %            8.987984e-01

@joyeecheung
Copy link
Member Author

Hmm, canary died but I can't be sure if the failures are related(most are in network-related modules, and node-sass has an error about platform support). @MylesBorins Am I using it properly?


Only [enumerable "own" properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties)
are considered. The `deepEqual()` implementation does not test the
[`[[Prototype]]`](https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots)
Copy link
Member

Choose a reason for hiding this comment

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

Please move the link ref to the end of the file and use an inline ref like:

[`[[Prototype]]`][]

Copy link
Member Author

@joyeecheung joyeecheung Feb 3, 2017

Choose a reason for hiding this comment

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

I used this but seems GitHub has a little bit trouble with that(I am guessing it's the [[ and ]] somehow confuses its parser?), not sure if the tooling can deal with it?

Only [enumerable "own" properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties)
are considered. The `deepEqual()` implementation does not test the
[`[[Prototype]]`](https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots)
of objects, attached symbols, or non-enumerable
Copy link
Member

Choose a reason for hiding this comment

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

This line is rather short, can you update this so that the line length is closer to 80


For the following cases, consider using ES2015 [`Object.is()`][],
which uses the
[SameValueZero](https://tc39.github.io/ecma262/#sec-samevaluezero) comparison.
Copy link
Member

Choose a reason for hiding this comment

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

Please move this to a reference at the bottom of the file also. :-)

result += str.replace(/[\\^$.*+?()[\]{}|=!<>:-]/g, '\\$&');
result += literals[i + 1];
}
return new RegExp('^AssertionError: ' + result + '$');
Copy link
Member

Choose a reason for hiding this comment

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

return new RegExp(`^AssertionError: ${result}$`);

@joyeecheung
Copy link
Member Author

@jasnell Thanks, PTAL. I am not quite sure about what to do the [[Prototype]] part, because neither the markdown rendering of GitHub nor our tooling can deal with them:

screen shot 2017-02-04 at 2 29 21 am

@jasnell
Copy link
Member

jasnell commented Feb 3, 2017

Escape the [ with a \ like so:

[\[\[Prototype\]\]][]

[\[\[Prototype\]\]]: https://example.org/link/to/whatever

For instance: [[Prototype]]

@joyeecheung
Copy link
Member Author

Hmm...putting it inside ` still doesn't work:

[`\[\[Prototype\]\]`]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots

screen shot 2017-02-04 at 4 00 59 pm

@joyeecheung
Copy link
Member Author

joyeecheung commented Feb 6, 2017

@addaleax @Trott Can you take a look at this if you have time since you've LTGM'ed #10282? Thanks!

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Same comments as on #10282 - it'd be great to cache everything at module level rather than trusting user-provided objects, or user code, not to have broken something.

lib/assert.js Outdated
}

function isArguments(tag) {
return tag == '[object Arguments]';
Copy link
Member

Choose a reason for hiding this comment

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

===

lib/assert.js Outdated
// for a list of tags pre-defined in the spec.
// There are some unspecified tags in the wild too (e.g. typed array tags).
// Since tags can be altered, they only serve fast failures
const actualTag = Object.prototype.toString.call(actual);
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as I made in #10282 - Object.prototype.toString should be cached at module level.

@joyeecheung
Copy link
Member Author

(I think the discussion about @ljharb 's comments can be moved here since those commented code is intended to be merged by this PR)

I am +1-ish on caching Object.prototype.toString and Object.keys for robustness, but I think this should be better pursued in a separate PR because this practice should be consistent across different lib modules, especially in util.objectToString(just discovered it), unless we have to avoid it for other reasons e.g. performance hit.

In the meantime I'll change Object.prototype.toString.call in this PR to use util.objectToString instead.

@joyeecheung joyeecheung force-pushed the refactor-assert branch 2 times, most recently from 1a83174 to bbc95aa Compare February 9, 2017 17:06
@joyeecheung
Copy link
Member Author

Rebased and, ah...right, I was being silly, the [[Prototype]] link can be easily fixed by using named reference links :P @jasnell PTAL.

@joyeecheung
Copy link
Member Author

Pinging @jasnell @Trott @addaleax for more reviews, thanks!

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

Code looks good but doc needs a few tweaks.

Primitive values are compared with the [Abstract Equality Comparison][]
( `==` ).

Only [enumerable "own" properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties)
Copy link
Member

Choose a reason for hiding this comment

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

Please move the link to the bottom and use an inline reference like [enumerable "own" properties][] to avoid having the over-long line

[`[[Prototype]]`][prototype-spec] of objects, attached symbols, or
non-enumerable properties (for those checks, consider using
[`assert.deepStrictEqual()`][] instead). This can lead to some
potentially surprising results. For example, the following example does no
Copy link
Member

Choose a reason for hiding this comment

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

s/does no/does not (end of the line)


For the following cases, consider using ES2015 [`Object.is()`][],
which uses the
[SameValueZero][] comparison.
Copy link
Member

Choose a reason for hiding this comment

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

Move this up to the previous line :-)

```

For more information, see
[MDN's guide on equality comparisons and sameness](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness).
Copy link
Member

Choose a reason for hiding this comment

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

Even tho this is at the end of the file, please move the link to the index at the end and use an inline reference for this as well, just for consistency :-)

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

One minor doc nit, but otherwise LGTM if CI is green and a CITGM run doesn't reveal anything alarming.

@joyeecheung
Copy link
Member Author

Punctuation fixed, thanks! @Trott

CI: https://ci.nodejs.org/job/node-test-pull-request/6473/

@joyeecheung
Copy link
Member Author

Recent CITGM jobs are all red, launched https://ci.nodejs.org/job/citgm-smoker/582/ against master and https://ci.nodejs.org/job/citgm-smoker/583/ against this PR for comparison.

because the properties on the [`Error`][] object are non-enumerable:
Only [enumerable "own" properties][] are considered. The `deepEqual()`
implementation does not test the [`[[Prototype]]`][prototype-spec] of
objects, attached symbols, or non-enumerable properties. (For those checks,
Copy link
Member

Choose a reason for hiding this comment

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

Just spotted this... can you actually remove the parens in this sentence. It can be reworded slightly as:

Only [enumerable "own" properties][] are considered. The `deepEqual()`
implementation does not test the [`[[Prototype]]`][prototype-spec] of objects,
attached symbols, or non-enumerable properties — for such checks, consider
using [assert.deepStrictEqual()][] instead.

Also, using deepEqual() in one sentence and assert.deepStrictEqual() in another is a bit inconsistent. Consider either using the assert. in both or omitting it from both.

Copy link
Member Author

@joyeecheung joyeecheung Feb 17, 2017

Choose a reason for hiding this comment

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

Oh yes, I was thinking parens look a bit awkward too, the hyphen does the trick!
I'll use assert.deepEqual() because it has a link already. Thanks!

[Abstract Equality Comparison]: https://tc39.github.io/ecma262/#sec-abstract-equality-comparison
[Strict Equality Comparison]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison
[`Object.is()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
[SameValueZero]: https://tc39.github.io/ecma262/#sec-SameValueZero
Copy link
Member

Choose a reason for hiding this comment

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

nit: #sec-samevaluezero

For more information, see
[MDN's guide on equality comparisons and sameness][mdn-equality-guide].

[Locked]: documentation.html#documentation_stability_index
Copy link
Member

Choose a reason for hiding this comment

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

this link is unused

@joyeecheung
Copy link
Member Author

@targos Thanks for the review, updated.

New CI: https://ci.nodejs.org/job/node-test-pull-request/6492/

The CITGM for the last code change has the same amount of failure as master ( (27 failures / ±0)), not sure if we can rely on this though...

@joyeecheung
Copy link
Member Author

Hmm..don't know what else does this PR need to land? CITGM is 27 failures and ±0 compared to its master.

@addaleax
Copy link
Member

@joyeecheung I don’t think there’s anything speaking against landing it. :)

@joyeecheung
Copy link
Member Author

@addaleax Alright, gonna land this tomorrow :) Thanks

@Trott Trott mentioned this pull request Feb 25, 2017
2 tasks
@Trott
Copy link
Member

Trott commented Feb 25, 2017

FYI, needs a rebase thanks to a PR I just landed.

lib/assert.js Outdated

function objEquiv(a, b, strict, actualVisitedObjects) {
if (a === null || a === undefined || b === null || b === undefined)
// GH-7178. Ensure reflexivity of deepEqual with `arguments` objects.
Copy link
Member

Choose a reason for hiding this comment

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

This is probably a good time to change that GH reference to a full URL. Generally a good idea, but especially here since it's not in this repository, but in the archive one instead:

nodejs/node-v0.x-archive#7178

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I'll update those links, thanks!

new Int32Array([1]), // Int32Array
new Uint32Array([1]), // Uint32Array
Buffer.from([1]),
// Arguments {'0': '1'} is not here, see GH-7178
Copy link
Member

Choose a reason for hiding this comment

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

Same here, full URL would be helpful: nodejs/node-v0.x-archive#7178

Refactors _deepEqual and fixes a few code paths that lead to
behaviors contradicting what the doc says. Before this commit
certain types of objects (Buffers, Dates, etc.) are not checked
properly, and can get away with different prototypes AND different
enumerable owned properties because _deepEqual would jump to
premature conclusion for them.

Since we no longer follow CommonJS unit testing spec,
the checks for primitives and object prototypes are moved
forward for faster failure.

Improve regexp and float* array checks:

* Don't compare lastIndex of regexps, because they are not
  enumerable, so according to the docs they should not be compared
* Compare flags of regexps instead of separate properties
* Use built-in tags to test for float* arrays instead of using
  instanceof

Use full link to the archived GitHub repository.

Use util.objectToString for future improvements to that function
that makes sure the call won't be tampered with.

Refs: nodejs#10282 (comment)
Refs: nodejs#10258 (comment)
Use the term "Abstract Equality Comparison" and "Strict Equality
Comparison" from ECMAScript specification to refer to the operations
done by `==` and `===`, instead of "equal comparison operator" and
"strict equality operator".

Clarify that deep strict comparisons checks `[[Prototype]]`
property, instead of the vague "object prototypes".

Suggest using `Object.is()` to avoid the caveats of +0, -0 and NaN.

Add a MDN link explaining what enumerable "own" properties are.
@joyeecheung
Copy link
Member Author

Rebased and squashed with full github links added.

New CI: https://ci.nodejs.org/job/node-test-pull-request/6583/
CITGM against master: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/599/
CITGM against this PR: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/600/

@gibfahn
Copy link
Member

gibfahn commented Feb 25, 2017

@nodejs/citgm do these failures look reasonable?

@joyeecheung
Copy link
Member Author

This is weird, the CITGM against this PR is (18 failures / -11), less failures than the master...is it just flakiness?

@joyeecheung
Copy link
Member Author

Not sure why CITGM got less errors with this PR, but according previous results I am pretty sure it's not related to the code change here. I am going to land this tomorrow if no more concerns arise...

@jasnell
Copy link
Member

jasnell commented Feb 27, 2017

CITGM and CI look fine. I've seen flakiness like that before.

@joyeecheung
Copy link
Member Author

Landed in 562cf5a and 3d8379a, thanks!

joyeecheung added a commit that referenced this pull request Feb 27, 2017
Refactors _deepEqual and fixes a few code paths that lead to
behaviors contradicting what the doc says. Before this commit
certain types of objects (Buffers, Dates, etc.) are not checked
properly, and can get away with different prototypes AND different
enumerable owned properties because _deepEqual would jump to
premature conclusion for them.

Since we no longer follow CommonJS unit testing spec,
the checks for primitives and object prototypes are moved
forward for faster failure.

Improve regexp and float* array checks:

* Don't compare lastIndex of regexps, because they are not
  enumerable, so according to the docs they should not be compared
* Compare flags of regexps instead of separate properties
* Use built-in tags to test for float* arrays instead of using
  instanceof

Use full link to the archived GitHub repository.

Use util.objectToString for future improvements to that function
that makes sure the call won't be tampered with.

PR-URL: #11128
Refs: #10282 (comment)
Refs: #10258 (comment)
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
joyeecheung added a commit that referenced this pull request Feb 27, 2017
Use the term "Abstract Equality Comparison" and "Strict Equality
Comparison" from ECMAScript specification to refer to the operations
done by `==` and `===`, instead of "equal comparison operator" and
"strict equality operator".

Clarify that deep strict comparisons checks `[[Prototype]]`
property, instead of the vague "object prototypes".

Suggest using `Object.is()` to avoid the caveats of +0, -0 and NaN.

Add a MDN link explaining what enumerable "own" properties are.

PR-URL: #11128
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@jasnell jasnell mentioned this pull request Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert Issues and PRs related to the assert subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants