Skip to content

JavaScript function hasOwnProperty() incorrectly returns false #578

@gilles-l

Description

@gilles-l

Hi,

I have an HTML form named testForm, with a hidden input named testInput, and testing the presence of that input with testForm.hasOwnProperty("testInput") returns false when run in HtmlUnit. In browsers, it returns true.

I have tested with both HtmlUnit 2.70 and 3.0.0, and hasOwnProperty() returns false with both versions. With 3.0.0, I have the additional issue that the test 'testForm.testInput !== undefined' also returns false. It returns true in HtmlUnit 2.70.

I have attached the HTML page, as well as a Unit test showing the issues.

Thanks,
Gilles

BugReport hasOwnProperty.zip

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions