ee93b178ce4495b2d0d27d79e6831620a4e7370a chmalee Thu Dec 22 10:08:15 2022 -0800 Remove leading and trailing whitespace before checking for standard range specifiers or before a chromosome name lookup, refs #30415 diff --git src/hg/js/utils.js src/hg/js/utils.js index 79633b9..45440a8 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -1,32 +1,32 @@ // Utility JavaScript // "use strict"; // Don't complain about line break before '||' etc: /* jshint -W014 */ var debug = false; /* Support these formats for range specifiers. Note the ()'s around chrom, * start and end portions for substring retrieval: */ -var canonicalRangeExp = /^([\w._#-]+)[\s]*:[\s]*([-0-9,]+)[\s]*[-_][\s]*([0-9,]+)$/; -var gbrowserRangeExp = /^([\w._#-]+)[\s]*:[\s]*([0-9,]+)[\s]*\.\.[\s]*([0-9,]+)$/; -var lengthRangeExp = /^([\w._#-]+)[\s]*:[\s]*([0-9,]+)[\s]*\+[\s]*([0-9,]+)$/; -var bedRangeExp = /^([\w._#-]+)[\s]+([0-9,]+)[\s]+([0-9,]+)$/; -var sqlRangeExp = /^([\w._#-]+)[\s]*\|[\s]*([0-9,]+)[\s]*\|[\s]*([0-9,]+)$/; -var singleBaseExp = /^([\w._#-]+)[\s]*:[\s]*([0-9,]+)$/; +var canonicalRangeExp = /^[\s]*([\w._#-]+)[\s]*:[\s]*([-0-9,]+)[\s]*[-_][\s]*([0-9,]+)$[\s]*/; +var gbrowserRangeExp = /^[\s]*([\w._#-]+)[\s]*:[\s]*([0-9,]+)[\s]*\.\.[\s]*([0-9,]+)$[\s]*/; +var lengthRangeExp = /^[\s]*([\w._#-]+)[\s]*:[\s]*([0-9,]+)[\s]*\+[\s]*([0-9,]+)[\s]*$/; +var bedRangeExp = /^[\s]*([\w._#-]+)[\s]+([0-9,]+)[\s]+([0-9,]+)[\s]*$/; +var sqlRangeExp = /^[\s]*([\w._#-]+)[\s]*\|[\s]*([0-9,]+)[\s]*\|[\s]*([0-9,]+)[\s]*$/; +var singleBaseExp = /^[\s]*([\w._#-]+)[\s]*:[\s]*([0-9,]+)[\s]*$/; function copyToClipboard(ev) { /* copy a piece of text to clipboard. event.target is some DIV or SVG that is an icon. * The attribute data-target of this element is the ID of the element that contains the text to copy. * see C function printCopyToClipboardButton(iconId, targetId); * */ var targetId = ev.target.getAttribute("data-target"); var textEl = document.getElementById(targetId); var text = textEl.innerText; var textArea = document.createElement("textarea"); textArea.value = text; // Avoid scrolling to bottom textArea.style.top = "0";