Skip to content

calls to the querySelector method are cut off in case of ADVANCED_OPTIMIZATIONS and turned off checkTypes warnings #2365

Closed
@nederland074

Description

@nederland074

The compilation of a file, which contains only one line:
document.querySelector(".test").some_prop = true;

leads to an empty output when using the compiler with these flags:
java -jar compiler.jar --compilation_level=ADVANCED_OPTIMIZATIONS --jscomp_off=checkTypes --js=in.js --js_output_file=out.js

However, enabling the checkTypes warnings (--jscomp_warning=checkTypes) fixes it and the output is ok: document.querySelector(".test").a=!0;

It doesn't matter if the altered property is a custom "some_prop" or a built-in one like the "className" or "id". Also, the querySelectorAll method doesn't have such an issue and the following code is compiled without problems:
document.querySelectorAll(".test")[0].some_prop = true;

It's reproduced in GCC v20161201.

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