Fix the multiple comments issue for Safari
The issue is gr-comment-thread created but not rendered (or bound to the slot correctly) after the first comment created. And just a simple replaceWith seems work fine for it. Bug: Issue 11182 Change-Id: Idb0a3db1372eb62bb31f3923692e48a1579a4480
This commit is contained in:
@@ -782,6 +782,7 @@
|
||||
// not hurt. It's probably a bigger performance cost to remove them than
|
||||
// to keep them around. Medium term we can even consider to add one slot
|
||||
// for each line from the start.
|
||||
let lastEl;
|
||||
for (const threadEl of addedThreadEls) {
|
||||
const lineNumString = threadEl.getAttribute('line-num') || 'FILE';
|
||||
const commentSide = threadEl.getAttribute('comment-side');
|
||||
@@ -800,6 +801,14 @@
|
||||
const slot = document.createElement('slot');
|
||||
slot.name = threadEl.getAttribute('slot');
|
||||
Polymer.dom(threadGroupEl).appendChild(Gerrit.slotToContent(slot));
|
||||
lastEl = threadEl;
|
||||
}
|
||||
|
||||
// Safari is not binding newly created comment-thread
|
||||
// with the slot somehow, replace itself will rebind it
|
||||
// @see Issue 11182
|
||||
if (lastEl && lastEl.replaceWith) {
|
||||
lastEl.replaceWith(lastEl);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user