Remove selectionToGFM
This commit is contained in:
parent
f90909307e
commit
9a0a4f17a4
2 changed files with 7 additions and 9 deletions
|
@ -343,13 +343,6 @@ class CopyAsGFM {
|
|||
return codeEl;
|
||||
}
|
||||
|
||||
static selectionToGFM(documentFragment, transformer) {
|
||||
const el = transformer(documentFragment.cloneNode(true));
|
||||
if (!el) return null;
|
||||
|
||||
return CopyAsGFM.nodeToGFM(el);
|
||||
}
|
||||
|
||||
static nodeToGFM(node) {
|
||||
if (node.nodeType === Node.COMMENT_NODE) {
|
||||
return '';
|
||||
|
|
|
@ -579,10 +579,15 @@ describe 'Copy as GFM', feature: true, js: true do
|
|||
def html_to_gfm(html, transformer = 'transformGFMSelection')
|
||||
js = <<-JS.strip_heredoc
|
||||
(function(html) {
|
||||
var transformer = window.gl.CopyAsGFM[#{transformer.inspect}];
|
||||
|
||||
var node = document.createElement('div');
|
||||
node.innerHTML = html;
|
||||
var transformer = window.gl.CopyAsGFM[#{transformer.inspect}];
|
||||
return window.gl.CopyAsGFM.selectionToGFM(node, transformer);
|
||||
|
||||
node = transformer(node);
|
||||
if (!node) return null;
|
||||
|
||||
return window.gl.CopyAsGFM.nodeToGFM(node);
|
||||
})("#{escape_javascript(html)}")
|
||||
JS
|
||||
page.evaluate_script(js)
|
||||
|
|
Loading…
Reference in a new issue