Unverified Commit 0e715362 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3100147 by gapple, longwave: Remove @import parsing from...

Issue #3100147 by gapple, longwave: Remove @import parsing from Drupal.AjaxCommands.prototype.add_css
parent 62afe776
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -1532,10 +1532,6 @@
    /**
     * Command to add css.
     *
     * Uses the proprietary addImport method if available as browsers which
     * support that method ignore @import statements in dynamically added
     * stylesheets.
     *
     * @param {Drupal.Ajax} [ajax]
     *   {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
     * @param {object} response
@@ -1546,21 +1542,7 @@
     *   The XMLHttpRequest status.
     */
    add_css(ajax, response, status) {
      // Add the styles in the normal way.
      $('head').prepend(response.data);
      // Add imports in the styles using the addImport method if available.
      let match;
      const importMatch = /^@import url\("(.*)"\);$/gim;
      if (
        document.styleSheets[0].addImport &&
        importMatch.test(response.data)
      ) {
        importMatch.lastIndex = 0;
        do {
          match = importMatch.exec(response.data);
          document.styleSheets[0].addImport(match[1]);
        } while (match);
      }
    },

    /**
+0 −10
Original line number Diff line number Diff line
@@ -629,16 +629,6 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
    },
    add_css: function add_css(ajax, response, status) {
      $('head').prepend(response.data);

      var match = void 0;
      var importMatch = /^@import url\("(.*)"\);$/gim;
      if (document.styleSheets[0].addImport && importMatch.test(response.data)) {
        importMatch.lastIndex = 0;
        do {
          match = importMatch.exec(response.data);
          document.styleSheets[0].addImport(match[1]);
        } while (match);
      }
    },
    message: function message(ajax, response) {
      var messages = new Drupal.Message(document.querySelector(response.messageWrapperQuerySelector));