git ssb

16+

Dominic / patchbay



Commit db575953239b738e0d908ed0e7005bc4aa45d14c

fixing some nully undefined logic

mix irving committed on 2/20/2018, 2:57:58 AM
Parent: f282bf4a9ac0e60ba0de219dad5704df86000ec5

Files changed

app/html/scroller.jschanged
app/page/thread.jschanged
app/html/scroller.jsView
@@ -42,22 +42,23 @@
4242 }
4343 }
4444 }
4545
46 + return function scroll (d) {
47 + selectChild((!curMsgEl || d === 'first') ? container.firstChild
48 + : d < 0 ? curMsgEl.previousElementSibling || container.firstChild
49 + : d > 0 ? curMsgEl.nextElementSibling || container.lastChild
50 + : curMsgEl)
51 +
52 + return curMsgEl
53 + }
54 +
4655 function selectChild (el) {
4756 if (!el) { return }
4857
49- if (!el.scrollIntoViewIfNeeded && !el.scrollIntoView) debugger
58 + if (!el.scrollIntoViewIfNeeded && !el.scrollIntoView) return
5059 ;(el.scrollIntoViewIfNeeded || el.scrollIntoView).call(el)
5160 el.focus()
5261 curMsgEl = el
5362 }
5463
55- return function scroll (d) {
56- selectChild((!curMsgEl || d === 'first') ? container.firstChild
57- : d < 0 ? curMsgEl.previousElementSibling || container.firstChild
58- : d > 0 ? curMsgEl.nextElementSibling || container.lastChild
59- : curMsgEl)
60-
61- return curMsgEl
62- }
6364 }
app/page/thread.jsView
@@ -101,9 +101,9 @@
101101 if (!tabs.currentPage().scroll) return setTimeout(locateKey, 200)
102102
103103 tabs.currentPage().scroll('first')
104104 const msg = tabs.currentPage().querySelector(`[data-id='${id}']`)
105- if (msg === undefined) return setTimeout(locateKey, 200)
105 + if (!msg) return setTimeout(locateKey, 200)
106106
107107 ;(msg.scrollIntoViewIfNeeded || msg.scrollIntoView).call(msg)
108108 msg.focus()
109109 }

Built with git-ssb-web