code: function (elem) {
      this._forEachNode(this._getAllNodesWithTag(elem, ["br"]), function(br) {
        var next = br.nextSibling;
  
        // Whether 2 or more <br> elements have been found and replaced with a
        // <p> block.
        var replaced = false;
  
        // If we find a <br> chain, remove the <br>s until we hit another element
        // or non-whitespace. This leaves behind the first <br> in the chain
        // (which will be replaced with a <p> later).
        while ((next = this._nextElement(next)) && (next.tagName == "BR")) {
          replaced = true;
          var brSibling = next.nextSibling;
          next.parentNode.removeChild(next);
          next = brSibling;
        }
  
        // If we removed a <br> chain, replace the remaining <br> with a <p>. Add
        // all sibling nodes as children of the <p> until we hit another <br>
        // chain.
        if (replaced) {
          var p = this._doc.createElement("p");
          br.parentNode.replaceChild(p, br);
  
          next = p.nextSibling;
          while (next) {
            // If we've hit another <br><br>, we're done adding children to this <p>.
            if (next.tagName == "BR") {
              var nextElem = this._nextElement(next.nextSibling);
              if (nextElem && nextElem.tagName == "BR")
                break;
            }
  
            if (!this._isPhrasingContent(next)) break;
  
            // Otherwise, make this node a child of the new <p>.
            var sibling = next.nextSibling;
            p.appendChild(next);
            next = sibling;
          }
  
          while (p.lastChild && this._isWhitespace(p.lastChild)) p.removeChild(p.lastChild);
        }
      });
    }
docs: Replaces 2 or more successive <br> elements with a single <p>.
  Whitespace between <br> elements are ignored. For example:
  <div>foo<br>bar<br> <br><br>abc</div>
  will become:
  <div>foo<br>bar<p>abc</p></div>