processAttributes(element, id) {
    var win = element.ownerDocument.defaultView;
    var style = win.getComputedStyle(element, null);
    var styleMap = {};
    for (var i = 0; i < style.length; i++) {
      var propertyName = style.item(i);
      styleMap[propertyName] = style.getPropertyValue(propertyName);
    }
    this.idToStyleMap[id] = styleMap;
    this.idToStyleIndex[id] = this.html.length;
    if (element.tagName == 'HTML') {
      this.rootStyleIndex = this.html.length;
      this.rootId = id;
    }
    this.processSimpleAttribute(win, 'style', style.cssText);
    this.processSimpleAttribute(win, 'id', id);

    var attributes = element.attributes;
    if (attributes) {
      for (var i = 0, attribute; attribute = attributes[i]; i++) {
        switch (attribute.name.toLowerCase())  {
          case 'src':
            this.processSrcAttribute(element, id);
            break;
          case 'style':
          case 'id':
            break;
          default:
            var name = attribute.name;
            var value = attribute.value;
            this.processSimpleAttribute(win, name, value);
        }
      }
      // TODO(sfine): Ensure this is working by making sure that an iframe
      //              will always have attributes.
      if (element.tagName == 'IFRAME' && element.attributes.src) {
        var valueIndex = this.processHoleAttribute(win, 'srcdoc');
        var iframeName = this.iframeQualifiedName(element.contentWindow);
        this.frameHoles[valueIndex] = iframeName;
      }
    }
  }
/**
   * Takes an html element, and populates this object's fields with the
   * appropriate attribute names and values.
   *
   * @param {Element} element The Element to serialize.
   * @param {string} id The id of the Element being serialized.
   * @private
   */
Takes an html element, and populates this object's fields with the
appropriate attribute names and values.

@param {Element} element The Element to serialize.
@param {string} id The id of the Element being serialized.
@private
Takes an html element and populates this object ' s fields with the appropriate attribute names and values . @param { Element } element The Element to serialize . @param { string } id The id of the Element being serialized . @private
processAttributes(element, id) {
    var win = element.ownerDocument.defaultView;
    var style = win.getComputedStyle(element, null);
    var styleMap = {};
    for (var i = 0; i < style.length; i++) {
      var propertyName = style.item(i);
      styleMap[propertyName] = style.getPropertyValue(propertyName);
    }
    this.idToStyleMap[id] = styleMap;
    this.idToStyleIndex[id] = this.html.length;
    if (element.tagName == 'HTML') {
      this.rootStyleIndex = this.html.length;
      this.rootId = id;
    }
    this.processSimpleAttribute(win, 'style', style.cssText);
    this.processSimpleAttribute(win, 'id', id);
    var attributes = element.attributes;
    if (attributes) {
      for (var i = 0, attribute; attribute = attributes[i]; i++) {
        switch (attribute.name.toLowerCase())  {
          case 'src':
            this.processSrcAttribute(element, id);
            break;
          case 'style':
          case 'id':
            break;
          default:
            var name = attribute.name;
            var value = attribute.value;
            this.processSimpleAttribute(win, name, value);
        }
      }
      if (element.tagName == 'IFRAME' && element.attributes.src) {
        var valueIndex = this.processHoleAttribute(win, 'srcdoc');
        var iframeName = this.iframeQualifiedName(element.contentWindow);
        this.frameHoles[valueIndex] = iframeName;
      }
    }
  }
processAttributes ( element , id ) { var win = element . ownerDocument . defaultView ; var style = win . getComputedStyle ( element , null ) ; var styleMap = { } ; for ( var i = 0 ; i < style . length ; i ++ ) { var propertyName = style . item ( i ) ; styleMap [ propertyName ] = style . getPropertyValue ( propertyName ) ; } this . idToStyleMap [ id ] = styleMap ; this . idToStyleIndex [ id ] = this . html . length ; if ( element . tagName == 'HTML' ) { this . rootStyleIndex = this . html . length ; this . rootId = id ; } this . processSimpleAttribute ( win , 'style' , style . cssText ) ; this . processSimpleAttribute ( win , 'id' , id ) ; var attributes = element . attributes ; if ( attributes ) { for ( var i = 0 , attribute ; attribute = attributes [ i ] ; i ++ ) { switch ( attribute . name . toLowerCase ( ) ) { case 'src' : this . processSrcAttribute ( element , id ) ; break ; case 'style' : case 'id' : break ; default : var name = attribute . name ; var value = attribute . value ; this . processSimpleAttribute ( win , name , value ) ; } } if ( element . tagName == 'IFRAME' && element . attributes . src ) { var valueIndex = this . processHoleAttribute ( win , 'srcdoc' ) ; var iframeName = this . iframeQualifiedName ( element . contentWindow ) ; this . frameHoles [ valueIndex ] = iframeName ; } } }
Takes an html element, and populates this object's fields with the
 appropriate attribute names and values.
Takes an html element and populates this object ' s fields with the appropriate attribute names and values .
// TODO(sfine): Ensure this is working by making sure that an iframe //              will always have attributes.