You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
github.com - GitHub "Quote Reply" adds extra empty lines in Firefox, removes empty lines in Edge #28521
changed the title [-]github.com - see bug description[/-][+]github.com - GitHub "Quote Reply" adds extra empty lines in Firefox, removes empty lines in Edge[/+]on Apr 8, 2019
In the previous comment, it will call Wn after serializing with toString(), It seems that toString() serializes differently in Chrome and Firefox.
functionWn(e,t){varn=(function(e,t,n){vars=e.trim();if(!s)return;varo=t.startContainer;if(!o)return;o.nodeType!==Node.ELEMENT_NODE&&(o=o.parentNode);if(!(oinstanceofElement))return;varr=Un(o);if(!r)return;vari=r.getAttribute("data-quote-markdown");if(null!=i&&!On)try{s=(function(e){vart=document.body;if(!t)return"";varn=document.createElement("div");n.appendChild(e),(n.style.cssText="position:absolute;left:-9999px;"),t.appendChild(n);vars="";try{varo=window.getSelection(),r=document.createRange();r.selectNodeContents(n),o.removeAllRanges(),o.addRange(r),(s=o.toString()),o.removeAllRanges(),r.detach();}finally{t.removeChild(n);}returns;})((function(e,t,n){vars=e.startContainer;if(!(s&&s.parentNode&&s.parentNodeinstanceofHTMLElement))thrownewError("the range must start within an HTMLElement");varo=s.parentNode,r=e.cloneContents();if(t){vari=r.querySelector(t);i&&(r=document.createDocumentFragment()).appendChild(i);}$n=0;vara=o.closest("li"),c=o.closest("pre");if(c){varl=document.createElement("pre");l.appendChild(r);varu=l;if(!n){vard=c.parentNode;if(dinstanceofHTMLElement&&_n(d)){varm=document.createElement("div");(m.className=d.className),m.appendChild(u),(u=m);}}(r=document.createDocumentFragment()).appendChild(u);}elseif(a&&a.parentNode&&("OL"===a.parentNode.nodeName&&($n=In(a)),!r.querySelector("li"))){varf=document.createElement("li");if(!a.parentNode)thrownewError();varg=document.createElement(a.parentNode.nodeName);f.appendChild(r),g.appendChild(f),(r=document.createDocumentFragment()).appendChild(g);}return(Bn(r,function(e,t){returne.replaceWith(t);}),r);})(t,i,n)).replace(/^\n+/,"").replace(/\s+$/,"");}catch(a){setTimeout(function(){throwa;});}return{selectionText: s,container: r};})(e,t,!1);if(!n)return!1;vars=n.container,o=n.selectionText;if(!s.dispatchEvent(newCustomEvent("quote-selection",{bubbles: !0,cancelable: !0,detail: {range: t,selectionText: o}})))return!0;varr=zn(s);return(!!r&&((function(e,t){varn="> ".concat(e.replace(/\n/g,"\n> "),"\n\n");t.value&&(n="".concat(t.value,"\n\n").concat(n));(t.value=n),t.dispatchEvent(newCustomEvent("change",{bubbles: !0,cancelable: !1})),t.focus(),(t.selectionStart=t.value.length),(t.scrollTop=t.scrollHeight);})(o,r),!0));}
My interpretation is that it serializes the text given by toString()
I will advertise this issue on the bugzilla issue, but I think we should contact GitHub, because I have the feeling that changing behavior of getSelection ot toString would create an armageddon of issues.
This bug seems to have been fixed on GitHub's side. I can't reproduce the bug in Firefox 67 or 69 Nightly, where previously I could reproduce in Firefox 68 and earlier. I'll close this issue.
Activity
[-]github.com - see bug description[/-][+]github.com - GitHub "Quote Reply" adds extra empty lines in Firefox, removes empty lines in Edge[/+]softvision-sergiulogigan commentedon Apr 8, 2019
Thanks @cpeterso for this one! I can reproduce this issue.
Tested with:
Browser / Version: Firefox Nightly 68.0a1 (2019-04-07)
Operating System: Windows 10 Pro
karlcow commentedon Apr 9, 2019
I have a hunch it is mildly related with the quote reply specifically, but with the text representation of content. It reminds me of https://bugzilla.mozilla.org/show_bug.cgi?id=1174452
Note also the additional line is happening only for lists, aka the rest is getting a normal treatment.
For example, a simple copy/paste of
select, copy and then paste into (where I put the cursor to the empty line )
then I get:
we can see the treatment is different.
Also
The quote reply is:
karlcow commentedon Apr 9, 2019
In the previous comment, it will call Wn after serializing with
toString(), It seems thattoString()serializes differently in Chrome and Firefox.My interpretation is that it serializes the text given by
toString()for example
serialized with Chrome
and with Firefox
I don't know if there is an open bug on Mozilla bugzilla for differences of toString.
karlcow commentedon Apr 9, 2019
We could contact I guess GitHub, because probably toString() is not the best way for interop.
There is https://bugzilla.mozilla.org/show_bug.cgi?id=1360238
among https://bugzilla.mozilla.org/buglist.cgi?quicksearch=window.getselection
karlcow commentedon Apr 9, 2019
I will advertise this issue on the bugzilla issue, but I think we should contact GitHub, because I have the feeling that changing behavior of getSelection ot toString would create an armageddon of issues.
miketaylr commentedon Apr 22, 2019
I sent an email to GitHub support -- I'm not really sure where this feature would live (if it's even open source), but they tend to be super helpful.
karlcow commentedon May 20, 2019
The behavior didn't change here so the mail for contact didn't work. @miketaylr also opened another issue which I think is related. #30041
cpeterso commentedon Jun 9, 2019
This bug seems to have been fixed on GitHub's side. I can't reproduce the bug in Firefox 67 or 69 Nightly, where previously I could reproduce in Firefox 68 and earlier. I'll close this issue.
cpeterso commentedon Jun 9, 2019
IIUC, I think checkbox reply issue #30041 is also fixed.
cipriansv commentedon Jun 12, 2019
I retested the issue and it is still reproducible on my side.
Tested with:
Browser / Version: Firefox Nightly 69.0a1 (2019-06-11)
Operating System: Windows 10 Pro
cpeterso commentedon Jun 12, 2019
Reopening this issue because I can reproduce this bug again, too.