Bug Tracker

Opened 7 years ago

Closed 7 years ago

#13641 closed bug (invalid)

:first-child selector doesn't work (:first doesn't fit)

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Контакты Ohotnik.by</title> <style type="text/css">ul{list-style-type: none;} li img{float: left; display: none;}</style> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> </head> <body> <ul> <li><a>www</a><img src="circle.png" width="10" height="10"/></li> <li><a>www</a><img src="circle.png" width="10" height="10"/><img src="circle.png" width="10" height="10"/> <a>www</a>

<ul>

<li><a>www</a> <a>www</a>

<img src="circle.png" width="10" height="10"/> <img src="circle.png" width="10" height="10"/>

</li> <li><a>www</a>

<img src="circle.png" width="10" height="10"/> <a>www</a> <img src="circle.png" width="10" height="10"/> <ul>

<li><a>www</a><img src="circle.png" width="10" height="10"/><img src="circle.png" width="10" height="10"/> <a>www</a> <img src="circle.png" width="10" height="10"/> </li> <li ><a>www</a><img src="circle.png" width="10" height="10"/><img src="circle.png" width="10" height="10"/> <a>www</a> <img src="circle.png" width="10" height="10"/>

<ul>

<li><a>www</a><img src="circle.png" width="10" height="10"/><img src="circle.png" width="10" height="10"/>

<ul>

<li><a>www</a><img src="circle.png" width="10" height="10"/><img src="circle.png" width="10" height="10"/></li> <li class="subact"><a>www</a><img src="circle.png" width="10" height="10"/><img src="circle.png" width="10" height="10"/></li>

</ul>

</li> <li><a>www</a><img src="circle.png" width="10" height="10"/><img src="circle.png" width="10" height="10"/></li>

</ul>

</li>

</ul>

</li>

</ul> </li>

</li> </ul> </body> <script type="text/javascript">

$('.subact').children('a:first-child').css('font-weight', 'bold').css('background', 'pink'); $('.subact').parents('li').children('img').css('display', 'block'); ------------------------------ Without :first-child it works perfect. But what if i want to hide only one image?

$('.subact').parents('li').children('img:first-child').css('padding', '10px').css('background', 'aqua'); <----------------- THE BUG ---- :first-child doesn't work. $('.subact').parents('li').children('img:first').css('padding', '10px').css('background', 'aqua'); <-------- And! :first doesn't fit ;)

$('.subact').parents('li').children('a:first-child').css('background', 'pink');

</script> </html>

P.S. thank you for creating and supporting jQuery! You're incredible!

Change History (2)

comment:1 Changed 7 years ago by dmethvin

Owner: set to anonymous
Status: newpending

Can you put a working example on jfiddle.net? Thanks!

comment:2 Changed 7 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

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!

Note: See TracTickets for help on using tickets.