l = $("#chat > div.monologue:last div.message:not(.pending):last");
views:
80answers:
2
+8
A:
It's getting last the <div class="message">
that doesn't have a the class pending"
that's a decendant of the last <div class="monologue">
that's a direct child of the id=chat"
element.
Since it looks like you're looking at SO chat code, here's the plain version:
It's getting the last chat message that's not one you just sent (and hasn't been confirmed by the server).
Nick Craver
2010-10-25 13:14:17
hoho, looks like you are the developer of SO?
Bin Chen
2010-10-25 13:20:56
@Bin - nope :) I just helped debugging a bit in the beta so your code's familiar :)
Nick Craver
2010-10-25 13:28:22
+1
A:
It targets the last <div class="message">
of <div class="monologue">
and makes sure it doesn't have pending
in the class attribute. Now the parent div, which is <div class="monologue">
, should be the last from its parent div, which is <div id="chat">
.
To make it clear see below:
<div id="chat">
<div class="monologue"></div>
<div class="monologue"></div>
<div class="monologue">
<div class="message pending"></div>
<div class="message pending"></div>
<div class="message"></div>
<div class="message"></div>
<!-- it's targeting this div -->
<div class="message"></div>
</div>
Shaoz
2010-10-25 13:42:08