code: function minimizeStyle(message, doc, element, id, index) {
    var originalStyleAttribute = element.getAttribute('style');
    var originalStyleMap = message.idToStyleMap[id];
    var requiredStyleMap = {};
    var maxNumberOfIterations = 5;
  
    // We compare the computed style before and after removing the style attribute
    // and accumulate the differences in |requiredStyleMap|. Because some
    // properties affect other properties, such as boder-style: solid causing a
    // change in border-width, we do this iteratively until a fixed-point is
    // reached (or |maxNumberOfIterations| is hit).
    for (var i = 0; i < maxNumberOfIterations; i++) {
      element.setAttribute('style', buildStyleAttribute(requiredStyleMap));
      var foundNewRequiredStyle = updateMinimizedStyleMap(
          doc,
          element,
          originalStyleMap,
          requiredStyleMap,
          null);
      element.setAttribute('style', buildStyleAttribute(originalStyleMap));
      if (!foundNewRequiredStyle) {
        break;
      }
    }
  
    var finalStyleAttribute = buildStyleAttribute(requiredStyleMap);
    if (finalStyleAttribute) {
      var nestingDepth = message.frameIndex.split('.').length - 1;
      finalStyleAttribute = finalStyleAttribute.replace(
          /"/g,
          escapedQuote(nestingDepth + 1));
      var quote = escapedQuote(nestingDepth);
      message.html[index] = `style=${quote}${finalStyleAttribute}${quote} `;
    } else {
      message.html[index] = '';
    }
  }
docs: Removes all style attribute properties that are unneeded for a single
  element.
  
  @param {Object} message The message Object that contains the element whose
  style attributes should be minimized.
  @param {Document} doc The Document that contains the rendered HTML.
  @param {Element} element The Element whose style attributes should be
  minimized.
  @param {string} id The id of the Element in the final page.
  @param {number} index The index in |message.html| where the Element's style
  attribute is specified.