processSrcAttribute(element, id) {
    var win = element.ownerDocument.defaultView;
    var url = this.qualifiedUrlForElement(element);
    var sameOrigin = window.location.host == url.host;
    switch (element.tagName) {
      case 'IFRAME':
        break; // Do nothing.
      case 'SOURCE':
        var parent = element.parent;
        if (parent && parent.tagName == 'PICTURE' && sameOrigin) {
          this.processSrcHole(element);
        } else {
          this.processSimpleAttribute(win, 'src', url.href);
        }
        break;
      case 'INPUT':
        var type = element.attributes.type;
        if (type && type.value.toLowerCase() == 'image') {
          this.processSrcHole(element);
        }
        break;
      case 'IMG':
        // Our method for calculating same-origin can be incorrect in
        // the presence of data urls loaded from (for example)
        // localhost, so check for and handle them explicitly. This
        // also avoids unnecessarily processing them asynchronously.
        if (this.isImageDataUrl(url.href)) {
          // Just pass the url through as it will render directly.
          this.processSimpleAttribute(win, 'src', url.href);
        } else if (sameOrigin) {
          this.processSrcHole(element);
        } else {
          this.externalImages.push([id, url.href]);
          this.processSimpleAttribute(win, 'src',
              this.getExternalImageUrl(id, url.href));
        }
        break;
      default:
        this.processSimpleAttribute(win, 'src', url.href);
    }
  }
/**
   * Process the src attribute of a given element.
   *
   * @param {Element} element The Element being processed, which has the src
   *     attribute.
   * @param {string} id The id of the Element being serialized.
   * @private
   */
Process the src attribute of a given element.
@param {Element} element The Element being processed, which has the src
attribute.
@param {string} id The id of the Element being serialized.
@private
Process the src attribute of a given element . @param { Element } element The Element being processed which has the src attribute . @param { string } id The id of the Element being serialized . @private
processSrcAttribute(element, id) {
    var win = element.ownerDocument.defaultView;
    var url = this.qualifiedUrlForElement(element);
    var sameOrigin = window.location.host == url.host;
    switch (element.tagName) {
      case 'IFRAME':
        break; 
      case 'SOURCE':
        var parent = element.parent;
        if (parent && parent.tagName == 'PICTURE' && sameOrigin) {
          this.processSrcHole(element);
        } else {
          this.processSimpleAttribute(win, 'src', url.href);
        }
        break;
      case 'INPUT':
        var type = element.attributes.type;
        if (type && type.value.toLowerCase() == 'image') {
          this.processSrcHole(element);
        }
        break;
      case 'IMG':
        if (this.isImageDataUrl(url.href)) {
          this.processSimpleAttribute(win, 'src', url.href);
        } else if (sameOrigin) {
          this.processSrcHole(element);
        } else {
          this.externalImages.push([id, url.href]);
          this.processSimpleAttribute(win, 'src',
              this.getExternalImageUrl(id, url.href));
        }
        break;
      default:
        this.processSimpleAttribute(win, 'src', url.href);
    }
  }
processSrcAttribute ( element , id ) { var win = element . ownerDocument . defaultView ; var url = this . qualifiedUrlForElement ( element ) ; var sameOrigin = window . location . host == url . host ; switch ( element . tagName ) { case 'IFRAME' : break ; case 'SOURCE' : var parent = element . parent ; if ( parent && parent . tagName == 'PICTURE' && sameOrigin ) { this . processSrcHole ( element ) ; } else { this . processSimpleAttribute ( win , 'src' , url . href ) ; } break ; case 'INPUT' : var type = element . attributes . type ; if ( type && type . value . toLowerCase ( ) == 'image' ) { this . processSrcHole ( element ) ; } break ; case 'IMG' : if ( this . isImageDataUrl ( url . href ) ) { this . processSimpleAttribute ( win , 'src' , url . href ) ; } else if ( sameOrigin ) { this . processSrcHole ( element ) ; } else { this . externalImages . push ( [ id , url . href ] ) ; this . processSimpleAttribute ( win , 'src' , this . getExternalImageUrl ( id , url . href ) ) ; } break ; default : this . processSimpleAttribute ( win , 'src' , url . href ) ; } }
Process the src attribute of a given element.
Process the src attribute of a given element .
// Do nothing. // Our method for calculating same-origin can be incorrect in // the presence of data urls loaded from (for example) // localhost, so check for and handle them explicitly. This // also avoids unnecessarily processing them asynchronously. // Just pass the url through as it will render directly.