Side navigation
#13772 closed bug (invalid)
Opened April 13, 2013 04:51AM UTC
Closed April 29, 2013 08:32AM UTC
:target selector works only after document is ready
Reported by: | GolubevS79@gmail.com | Owned by: | GolubevS79@gmail.com |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I'm not sure this is bug (may be it's documentation issue) but ":target" selector works only in .ready() handler, i.e.
<script> console.log($(":target").length); // returns 0 $(document).ready(function(){ console.log($(":target").length); // returns 1 }); </script>
Attachments (0)
Change History (6)
Changed April 13, 2013 05:06AM UTC by comment:1
Changed April 13, 2013 05:14AM UTC by comment:2
owner: | → GolubevS79@gmail.com |
---|---|
status: | new → pending |
Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!
Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists—you may need to change this to a specific version depending on the test case.
To get you started, use the appropriate boilerplate:
- jQuery 1.x http://jsfiddle.net/FrKyN/
- jQuery 2.x http://jsfiddle.net/VUp3e/
Open the link and click to "Fork" (in the top menu) to begin.
Also, please read:
- http://blog.jquery.com/2013/03/01/jquery-2-0-beta-2-released/
- http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/
Additional resources:
- Won't Fix: http://contribute.jquery.org/wont-fix/
- CLA: http://contribute.jquery.org/CLA/
- Style Guide: http://contribute.jquery.org/style-guide/js/
Changed April 13, 2013 06:21AM UTC by comment:3
status: | pending → new |
---|
Sorry guys, but as to jsFiddle the example requires hash fragment in page URL (it is possible to set "window.location.hash" property in the script, but the example works different in this case).
I've tested on the 2.x (edge) version and good results was obtained only in IE10.
If jsFiddle is absolutely necessary let's close the ticket
Changed April 13, 2013 12:27PM UTC by comment:4
status: | new → pending |
---|
You can create a jsFiddle and access it directly by appending "/embedded/result/" to the URL or you can link to a demonstration page somewhere else, but we do need reproducible test cases in order to analyze and fix bugs.
Changed April 14, 2013 11:03PM UTC by comment:5
Actually, appending /embedded/result/
doesn't help as it still adds a jsFiddle banner at the top and puts the test URL into an iframe. Appending /show/light/
works, though.
Changed April 29, 2013 08:32AM UTC by comment:6
resolution: | → invalid |
---|---|
status: | pending → closed |
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
In this example, the target element already existed at the time of the script (i.e. <script> is the last element on the page)