Bug 135009
| Summary: | assign undefined value to Element property throws TypeError | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | ShihChi Huang <huge.huang+webkitbug> |
| Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Major | CC: | ap, ggaren, oliver, zalan |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | iPhone / iPad | ||
| OS: | Other | ||
ShihChi Huang
Prior to iOS8 Safari / Safari 8.0 if we assign undefined to Element property (like document.body.scrollTop) it fallback to 0
```js
document.body.scrollTop = undefined;
TypeError: Type error
column: 110
line: 1
message: "Type error"
stack: "eval code↵eval@[native code]↵_evaluateOn↵_evaluateAndWrap↵evaluate"
__proto__: Error
```
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Oliver Hunt
Hmmm, this is complaining about assigning NaN (undefined is being number coerced)
Maybe due to fractional coordinates?
Alexey Proskuryakov
Good point. Can you still reproduce with a current WebKit nightly? I thought that the fractional coordinate change was already undone.
Oliver Hunt
I think this is a dupe of bug #134841
ShihChi Huang
awesome, I cannot repro in webkit nightly r171105
alan
(In reply to comment #2)
> Good point. Can you still reproduce with a current WebKit nightly? I thought that the fractional coordinate change was already undone.
It's been reverted only for Element.scroll*. Other properties' (Element.offset*, Element.client*) return type is still double.
*** This bug has been marked as a duplicate of bug 134841 ***