-
Notifications
You must be signed in to change notification settings - Fork 385
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
Number constructor issues #365
Comments
|
Turns out the "wrap constructor" l implemented doesn't work in ES3 - I just forgot to check for true ES5 support before adding that particular shim. I'll add the guard, and update the docs.
|
@zloirock how can you detect "new" between |
@ljharb abstract |
I'm afraid I can't really make any sense of your code, so I can't just "see" it. If you're unwilling to share it here in a specific manner, then that's fine. While I see that you're testing that |
Instead of |
Please be respectful, there's no need to be rude. Obviously |
Sorry if offended, I'm just tired. Sloppe mode does not change here anything. An object will be returned on something like |
It changes whether |
But |
In sloppy mode, |
|
I guess I just don't understand how |
I've gotten all tests to pass except when a Number object is passed as the receiver that has the same primitive value as the first argument to the constructor. I can't conceive of any way without |
I also fixed my |
I believe the only remaining issue now from your original post is I'll reopen this issue if |
Thanks for confirming - I'll reopen. I honestly have no idea how this works, but if it's possible without |
k, thanks - I figured it out. Appreciate the reports and the followthrough! |
BTW as I wrote above, function Internal(){
return this instanceof Internal ? Object.create(Public.prototype) : 42;
}
var Public = Internal.bind(null);
Public.prototype = {constructor: Public};
console.log(new Public); // => object
console.log(Public()); // => 42
console.log(Public.call(new Public)) // => 42;
console.log(Public.call(Object.create(Public.prototype))); // => 42 But |
Ideally the Thanks for explaining the |
Latest fix released in |
I wrote it already 4 or 5 times, but the first bug still not fixed - |
@zloirock I haven't found any evidence of that but I'm probably missing something. Would you mind filing a new issue detailing which constants are removed in ES3 engines? |
Number
constructor usesObject.getOwnPropertyNames
. It can't be completely polyfilled. Missed fallback for ES3 environment. What does it mean? All ES5- constructor properties lost in IE8-.Number.NaN
,Number.MAX_VALUE
,Number.NEGATIVE_INFINITY
, etc...this instanceof Number
in constructor not enough fornew
detection. For examplle, issue about Chai. Ines6-shim
some subsets of this bug, 2 main:typeof Object(1).constructor(2) == 'object'
+new Number(1)
throws errores6-shim
arhitecture. Not a bug, just for info.Also was some issues about
_.isNative(Number)
.The text was updated successfully, but these errors were encountered: