Verified Commit 6a43b511 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3238308 by mstrelan, bnjmnm, nod_, smustgrave, larowlan, rikki_iki:...

Issue #3238308 by mstrelan, bnjmnm, nod_, smustgrave, larowlan, rikki_iki: Refactor (if feasible) uses of the jQuery css function to use Vanilla/native
parent 2e3dea7a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
    "jquery/no-class": 0,
    "jquery/no-clone": 0,
    "jquery/no-closest": 0,
    "jquery/no-css": 0,
    "jquery/no-css": 2,
    "jquery/no-data": 0,
    "jquery/no-deferred": 0,
    "jquery/no-delegate": 2,
+1 −0
Original line number Diff line number Diff line
@@ -1486,6 +1486,7 @@
     *   The XMLHttpRequest status.
     */
    css(ajax, response, status) {
      // eslint-disable-next-line jquery/no-css
      $(response.selector).css(response.argument);
    },

+2 −1
Original line number Diff line number Diff line
@@ -89,7 +89,8 @@
        '.form-actions input[type=submit], .form-actions a.button, .form-actions a.action-link',
      );
      $buttons.each(function () {
        const $originalButton = $(this).css({ display: 'none' });
        const $originalButton = $(this);
        this.style.display = 'none';
        buttons.push({
          text: $originalButton.html() || $originalButton.attr('value'),
          class: $originalButton.attr('class'),
+3 −3
Original line number Diff line number Diff line
@@ -118,10 +118,10 @@
      const autoResize = debounce(resetSize, 20);
      const eventData = { settings, $element };
      if (settings.autoResize === true || settings.autoResize === 'true') {
        $element
        const uiDialog = $element
          .dialog('option', { resizable: false, draggable: false })
          .dialog('widget')
          .css('position', 'fixed');
          .dialog('widget');
        uiDialog[0].style.position = 'fixed';
        $(window)
          .on('resize.dialogResize scroll.dialogResize', eventData, autoResize)
          .trigger('resize.dialogResize');
+22 −18
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@
      let offset = 0;

      // Let scroll element take all the height available.
      $element.css({ height: 'auto' });
      $element[0].style.height = 'auto';
      const modalHeight = $container.height();

      $offsets.each((i, e) => {
@@ -214,7 +214,7 @@
      }
      // Set a minimum height on $element
      if (position === 'top') {
        $element.css('min-height', `${Drupal.offCanvas.minimumHeight}px`);
        $element[0].style.minHeight = `${Drupal.offCanvas.minimumHeight}px`;
      }

      displace();
@@ -236,9 +236,12 @@
        position === 'side'
          ? `${$(window).height() - (offsets.top + offsets.bottom)}px`
          : event.data.settings.height;
      container.css({

      Object.assign(container[0].style, {
        position: 'fixed',
        height,
        height: Number.isNaN(parseFloat(height))
          ? height
          : `${parseFloat(height)}px`,
      });

      $element
@@ -267,24 +270,26 @@
      Drupal.offCanvas.resetPadding();
      const $element = event.data.$element;
      const $container = Drupal.offCanvas.getContainer($element);
      const $mainCanvasWrapper = Drupal.offCanvas.$mainCanvasWrapper;
      const mainCanvasWrapper = Drupal.offCanvas.$mainCanvasWrapper[0];

      const width = $container.outerWidth();
      const mainCanvasPadding = $mainCanvasWrapper.css(
        `padding-${Drupal.offCanvas.getEdge()}`,
      );
      const mainCanvasPadding =
        window.getComputedStyle(mainCanvasWrapper)[
          `padding-${Drupal.offCanvas.getEdge()}`
        ];

      if (position === 'side' && width !== mainCanvasPadding) {
        $mainCanvasWrapper.css(
          `padding-${Drupal.offCanvas.getEdge()}`,
          `${width}px`,
        );
        mainCanvasWrapper.style[
          `padding-${Drupal.offCanvas.getEdge()}`
        ] = `${width}px`;

        $container.attr(`data-offset-${Drupal.offCanvas.getEdge()}`, width);
        displace();
      }

      const height = $container.outerHeight();
      if (position === 'top') {
        $mainCanvasWrapper.css('padding-top', `${height}px`);
        mainCanvasWrapper.style.paddingTop = `${height}px`;
        $container.attr('data-offset-top', height);
        displace();
      }
@@ -316,11 +321,10 @@
     * Resets main canvas wrapper and toolbar padding / margin.
     */
    resetPadding() {
      Drupal.offCanvas.$mainCanvasWrapper.css(
        `padding-${Drupal.offCanvas.getEdge()}`,
        0,
      );
      Drupal.offCanvas.$mainCanvasWrapper.css('padding-top', 0);
      Drupal.offCanvas.$mainCanvasWrapper[0].style[
        `padding-${Drupal.offCanvas.getEdge()}`
      ] = 0;
      Drupal.offCanvas.$mainCanvasWrapper[0].style.paddingTop = 0;
      displace();
    },
  };
Loading