
// TODO import Raven and log messages


const hasClipboardAPI = () => {
    let result = false;

    try {
        result = document.queryCommandSupported &&
                 document.queryCommandSupported('copy');
    } catch (e) { }
    return result;
};

/**
 * Safely copies the contents of `element` argument to the clipboard.
 *
 * Uses approach seen in clipboard.js and copy-to-clipboard. Not all
 * elements will have a `select()` method, so it uses the range &
 * selection objects from `document` to achieve the text copy.
 *
 * @param element - DOM node to copy
 */
const copyElement = (element) => {
    let copied = false;
    if (hasClipboardAPI()) {
        let range = document.createRange(),
            selection = document.getSelection();

        try {
            // avoid potential 'Discontiguous selection is not supported'
            // error that is generated by an existing selection followed
            // by the "addRange" call below
            selection.removeAllRanges();

            // done for "none" text area or text field elements
            range.selectNode(element);
            selection.addRange(range);

            // this call the largest candidate for creating
            // an error to catch - we could slim it down
            // to just this call
            copied = document.execCommand('copy');

            // clean up selections ...
            selection.removeAllRanges();
        } catch (e) {

        }
    }

    return copied;
};

export { copyElement, hasClipboardAPI };

@@ -1032,16 +1032,14 @@
 %22non
-e%22 
+%22-
 text
- 
 area
@@ -1046,17 +1046,16 @@
  or text
- 
 field el
@@ -1061,16 +1061,81 @@
 lements%0A
+            // - text DOM elements will have a %60select()%60 method%0A
         

Clarify comment _phrasing_