willtheorangeguy / Note-Style-Guide

Bad usage of RegExp#exec and String#match JS-D007
Performance
Major
5 months ago2 years old
10241      updateKey = response.url.match(/[?|&]update=([^&]+)($|&)/)
10242        ? RegExp.$1
10243        : null;
10244      addElement = response.url.match(/[?|&]add_element=([^&]+)($|&)/)10245        ? RegExp.$1
10246        : null;
10247      $(".webform-ajax-refresh").trigger("click");
10238      a.pathname === window.location.pathname &&
10239      $(".webform-ajax-refresh").length
10240    ) {
10241      updateKey = response.url.match(/[?|&]update=([^&]+)($|&)/)10242        ? RegExp.$1
10243        : null;
10244      addElement = response.url.match(/[?|&]add_element=([^&]+)($|&)/)
10225    // @see https://stackoverflow.com/questions/6944744/javascript-get-portion-of-url-path
10226    var a = document.createElement("a");
10227    a.href = response.url;
10228    var forceReload = response.url.match(/\?reload=([^&]+)($|&)/)10229      ? RegExp.$1
10230      : null;
10231    if (forceReload) {
10738      updateKey = response.url.match(/[?|&]update=([^&]+)($|&)/)
10739        ? RegExp.$1
10740        : null;
10741      addElement = response.url.match(/[?|&]add_element=([^&]+)($|&)/)10742        ? RegExp.$1
10743        : null;
10744      $(".webform-ajax-refresh").trigger("click");
10735      a.pathname === window.location.pathname &&
10736      $(".webform-ajax-refresh").length
10737    ) {
10738      updateKey = response.url.match(/[?|&]update=([^&]+)($|&)/)10739        ? RegExp.$1
10740        : null;
10741      addElement = response.url.match(/[?|&]add_element=([^&]+)($|&)/)