Commit 9a0a4f17 authored by Douwe Maan's avatar Douwe Maan

Remove selectionToGFM

parent f9090930
...@@ -343,13 +343,6 @@ class CopyAsGFM { ...@@ -343,13 +343,6 @@ class CopyAsGFM {
return codeEl; return codeEl;
} }
static selectionToGFM(documentFragment, transformer) {
const el = transformer(documentFragment.cloneNode(true));
if (!el) return null;
return CopyAsGFM.nodeToGFM(el);
}
static nodeToGFM(node) { static nodeToGFM(node) {
if (node.nodeType === Node.COMMENT_NODE) { if (node.nodeType === Node.COMMENT_NODE) {
return ''; return '';
......
...@@ -579,10 +579,15 @@ describe 'Copy as GFM', feature: true, js: true do ...@@ -579,10 +579,15 @@ describe 'Copy as GFM', feature: true, js: true do
def html_to_gfm(html, transformer = 'transformGFMSelection') def html_to_gfm(html, transformer = 'transformGFMSelection')
js = <<-JS.strip_heredoc js = <<-JS.strip_heredoc
(function(html) { (function(html) {
var transformer = window.gl.CopyAsGFM[#{transformer.inspect}];
var node = document.createElement('div'); var node = document.createElement('div');
node.innerHTML = html; 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)}") })("#{escape_javascript(html)}")
JS JS
page.evaluate_script(js) page.evaluate_script(js)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment