Verified Commit cd9fed87 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3238849 by mstrelan, hooroomoo, smustgrave, bnjmnm, larowlan: Refactor...

Issue #3238849 by mstrelan, hooroomoo, smustgrave, bnjmnm, larowlan: Refactor (if feasible) use of jquery is function to use vanillaJS
parent b8bb2e9f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
    "jquery/no-in-array": 0,
    "jquery/no-is-array": 0,
    "jquery/no-is-function": 2,
    "jquery/no-is": 0,
    "jquery/no-is": 2,
    "jquery/no-load": 2,
    "jquery/no-map": 2,
    "jquery/no-merge": 2,
+1 −1
Original line number Diff line number Diff line
@@ -459,7 +459,7 @@
    // If no Ajax callback URL was given, use the link href or form action.
    if (!this.url) {
      const $element = $(this.element);
      if ($element.is('a')) {
      if (this.element.tagName === 'A') {
        this.url = $element.attr('href');
      } else if (this.element && element.form) {
        this.url = this.$form.attr('action');
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@
          click(e) {
            // If the original button is an anchor tag, triggering the "click"
            // event will not simulate a click. Use the click method instead.
            if ($originalButton.is('a')) {
            if ($originalButton[0].tagName === 'A') {
              $originalButton[0].click();
            } else {
              $originalButton
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@
     *   True this is currently an off-canvas dialog.
     */
    isOffCanvas($element) {
      return $element.is('#drupal-off-canvas');
      return $element[0].id === 'drupal-off-canvas';
    },

    /**
+30 −0
Original line number Diff line number Diff line
@@ -645,6 +645,36 @@ window.Drupal = { behaviors: {}, locale: {} };
  Drupal.theme.placeholder = function (str) {
    return `<em class="placeholder">${Drupal.checkPlain(str)}</em>`;
  };

  /**
   * Determine if an element is visible.
   *
   * @param {HTMLElement} elem
   *   The element to check.
   *
   * @return {boolean}
   *  True if the element is visible.
   */
  Drupal.elementIsVisible = function (elem) {
    return !!(
      elem.offsetWidth ||
      elem.offsetHeight ||
      elem.getClientRects().length
    );
  };

  /**
   * Determine if an element is hidden.
   *
   * @param {HTMLElement} elem
   *   The element to check.
   *
   * @return {boolean}
   *  True if the element is hidden.
   */
  Drupal.elementIsHidden = function (elem) {
    return !Drupal.elementIsVisible(elem);
  };
})(
  Drupal,
  window.drupalSettings,
Loading