Different behavior of querySelector depending on the caller
Reported by
rianb...@gmail.com,
Jul 16 2016
|
|||||
Issue descriptionChrome Version : <Version 51.0.2704.106 (64-bit)> URLs (if applicable) : http://queryselector-question.m3c.space/ Other browsers tested: Add OK or FAIL, along with the version, after other browsers where you have tested this issue: Safari: NOT TESTED Firefox: NOT TESTED IE: NOT TESTED What steps will reproduce the problem? (1) http://queryselector-question.m3c.space/ (2) querySelector at document.currentScript.ownerDocument (3) Capital Case for the identifier What is the expected result? HTMLElement What happens instead? Null Please provide any additional information below. Attach a screenshot if possible. https://github.com/w3c/web-platform-tests/issues/3301
,
Jul 18 2016
Thanks for the feedback. Let's explain the situation. I'm using chrome 51, under Linux CentOS. And, I was planning with a feature called link rel=import . Can you please test the code given at the demo? This test passes (green) on Opera. Thanks.
,
Jul 18 2016
In Chrome the test is red. And I'm querying the div by using capital letters. Any capital letter at the id will not be accepted by the query selector.
,
Jul 18 2016
Another thing that you should consider is that any instance of Document has a method called querySelector(query).
The behavior of querySelector doesn't change if calling from a document, or from a fragment or even from a shadowRoot. Right?
So, why querySelector doesn't work correclty from inside document.currentScript.ownerDocument ?
Let's supose,
<div id="myId"></div>
<script>
var ownerDocument = document.currentScript.ownerDocument;
var d = ownerDocument.querySelector('div#myId'); // this should point to the div
// but not, d = null at this point
</script>
The test itself shows how to reproduce the error.
If you put any capital letter inside the querySelector's param, then the query will return null.
,
Jul 18 2016
If you notice, in my example, I'm using the querySelector inside a document that comes from a <link> - Right there is located the problem.
,
Jul 18 2016
Thank you for providing more feedback. Adding requester "durga.behera@chromium.org" for another review and adding "Needs-Review" label for tracking. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jul 18 2016
The Opera 38.0.2220.41 on a Mac 10.11.5 too behaves the same as chrome. Could you please help providing a screen shot/screen cast of the expected result.
,
Jul 18 2016
Durga, hello again )) I can't do a screen-shot because I don't have Opera in my laptop, but from daughter's smartphone both tests pass on green. Let's review... 1) can you read the code? view-source:http://queryselector-question.m3c.space/external.html 9th line? I expect to see "Pass" instead of "Fail". 2) if is expected to see "Fail" then, please tell me where the HTML-standard states that querySelector doesn't accept capital case when using it under <link rel="import">. I'm getting confused with this bug. And I want to understand if I'm missing something or definitely this "Fail" test shows a real bug? I expect to see "Pass" in both tests. Thanks for your patience.
,
Jul 19 2016
Thank you for providing more feedback. Adding requester "durga.behera@chromium.org" for another review and adding "Needs-Review" label for tracking. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jul 28 2016
Please, close this issue. I added the correct DOCTYPE and all came green. Thanks a lot for your time and patience!
,
Jan 5 2017
Thanks for the update, closing it as per the above comment #10. Please report a new issue if you still have any using chrome in future. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by durga.behera@chromium.org
, Jul 18 2016Labels: Needs-Feedback
66.0 KB
66.0 KB View Download