-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
calls to the querySelector method are cut off in case of ADVANCED_OPTIMIZATIONS and turned off checkTypes warnings #2365
Comments
Hm. I wonder if we accidentally made an assumption somewhere that anyone using advanced mode would also be using typechecking. |
any progress on this? Ran into it today with both v20170910 and v20171023 |
I played around some with reproducing this today. Further note regarding the "it doesn't happen with |
|
@ChadKillingsworth thanks for that info. Suppose we have code like this: someExternFunction().someProperty = something;
I have a change to fix this in internal review. |
@brad4d Yeah - that was just a reminder for external viewers. |
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.
The text was updated successfully, but these errors were encountered: