UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134
Steps to reproduce the problem:
1. Create a file named test.xhtml and a file named test.html, both with the content below:
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Script Defer Test</title><script src="test.js" defer="defer"></script></head><body><div id="test"></div></body></html>
2. Create a file named test.js with the content below:
3. Open each file and compare the console log
What is the expected behavior?
Both have <div id="test"></div>
What went wrong?
The HTML file has the expected output while the XHTML file has null
Does it occur on multiple sites: Yes
Is it a problem with a plugin? No
Did this work before? No
Does this work in other browsers? Yes
Chrome version: 64.0.3282.140 Channel: n/a
OS Version: 10.0
This bug was first reported in #611136, which is closed as "won't fix". More than 2 years have passed and the bug remains. Microsoft Edge and Firefox do not have the same bug. I hope the team will reconsider fixing this bug.