captbaritone / captbaritone/datejs

Extended Number.prototype

Open
#167 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
JavaScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
What steps will reproduce the problem?
1. Add to nvd3/examples/stackedAreaChart.html
obtained from https://github.com/novus/nvd3.git
2. Open the html file.

What is the expected output? What do you see instead?
"TypeError: invalid 'in' operand b"
> if (k in b)
at nvd3/lib/d3.v2.js Line 3328

What version of the product are you using? On what operating system?
The latest date.js @Feb 27th 2013
The latest NVD3 @Feb 27th 2013
Firefox 19.0

Please provide any additional information below.
The variable a is 2.2 in this example.
But index k picks up "_dateElement" because date.js extends Number.prototype.

d3.interpolateObject = function(a, b) {
var i = {}, c = {}, k;
for (k in a) {
if (k in b) {
i[k] = d3_interpolateByName(k)(a[k], b[k]);
} else {
c[k] = a[k];
}
}
...

Extending prototype of primitive objects sometimes restricts users to use
hasOwnProperty() or not to use inherited properties.
Is it possible to add properties with Object.defineProperty instead?
```

Original issue reported on code.google.com by `k1assisi...@gmail.com` on 27 Feb 2013 at 5:46

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.