Make the :last-child selector more specific

otherwise deeper leaf-nodes get returned
This commit is contained in:
JC Brand 2017-12-22 20:49:10 +00:00
parent 49addedd1f
commit 3cf7fefaa8
4 changed files with 5 additions and 5 deletions

View File

@ -1827,7 +1827,7 @@
displayJoinNotification (stanza) { displayJoinNotification (stanza) {
const nick = Strophe.getResourceFromJid(stanza.getAttribute('from')); const nick = Strophe.getResourceFromJid(stanza.getAttribute('from'));
const stat = stanza.querySelector('status'); const stat = stanza.querySelector('status');
const last_el = this.content.querySelector(':last-child'); const last_el = this.content.querySelector('.message:last-child');
if (_.includes(_.get(last_el, 'classList', []), 'chat-info') && if (_.includes(_.get(last_el, 'classList', []), 'chat-info') &&
_.get(last_el, 'dataset', {}).leave === `"${nick}"`) { _.get(last_el, 'dataset', {}).leave === `"${nick}"`) {
last_el.outerHTML = last_el.outerHTML =

View File

@ -1 +1 @@
<div class="chat-info" {{{o.data}}}>{{{o.message}}}</div> <div class="message chat-info" {{{o.data}}}>{{{o.message}}}</div>

View File

@ -1,4 +1,4 @@
<div class="chat-message {{{o.extra_classes}}}" data-isodate="{{{o.isodate}}}" data-msgid="{{{o.msgid}}}"> <div class="message chat-message {{{o.extra_classes}}}" data-isodate="{{{o.isodate}}}" data-msgid="{{{o.msgid}}}">
<span class="chat-msg-author chat-msg-{{{o.sender}}}">{{{o.time}}} {{{o.username}}}:&nbsp;</span> <span class="chat-msg-author chat-msg-{{{o.sender}}}">{{{o.time}}} {{{o.username}}}:&nbsp;</span>
<span class="chat-msg-content"><!-- message gets added here via renderMessage --></span> <span class="chat-msg-content"><!-- message gets added here via renderMessage --></span>
</div> </div>

View File

@ -169,7 +169,7 @@
return _.includes(el.classList, className); return _.includes(el.classList, className);
}; };
u.slideOut = function (el, duration=250) { u.slideOut = function (el, duration=200) {
/* Shows/expands an element by sliding it out of itself /* Shows/expands an element by sliding it out of itself
* *
* Parameters: * Parameters:
@ -233,7 +233,7 @@
}); });
}; };
u.slideIn = function (el, duration=250) { u.slideIn = function (el, duration=200) {
/* Hides/collapses an element by sliding it into itself. */ /* Hides/collapses an element by sliding it into itself. */
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (_.isNil(el)) { if (_.isNil(el)) {