B2G/gaia/apps/homescreen/js/page.js
/*
   * Renders the icon into the page
   *
   * @param{Object} where the icon should be rendered
   *
   * @param{Object} where the draggable element should be appened
   */
Renders the icon into the page
@param{Object} where the icon should be rendered

@param{Object} where the draggable element should be appened
Renders the icon into the page @param { Object } where the icon should be rendered @param { Object } where the draggable element should be appened
function icon_render(target) {
    var container = this.container = document.createElement('li');
    container.className = 'icon';
    if (this.descriptor.hidden) {
      delete this.descriptor.hidden;
      container.dataset.visible = false;
    }
    var descriptor = this.descriptor;
    container.dataset.isIcon = true;
    this._descriptorIdentifiers.forEach(function(prop) {
      var value = descriptor[prop];
      if (value)
        container.dataset[prop] = value;
    });
    var localizedName = descriptor.localizedName || descriptor.name;
    container.setAttribute('role', 'button');
    container.setAttribute('aria-label', localizedName);
    var icon = this.icon = document.createElement('div');
    var img = this.img = new Image();
    img.setAttribute('role', 'presentation');
    img.width = MAX_ICON_SIZE + ICON_PADDING_IN_CANVAS;
    img.height = MAX_ICON_SIZE + ICON_PADDING_IN_CANVAS;
    img.style.visibility = 'hidden';
    if (descriptor.renderedIcon) {
      this.displayRenderedIcon();
    } else {
      this.fetchImageData();
    }
    icon.appendChild(img);
    var wrapper = document.createElement('span');
    wrapper.className = 'labelWrapper';
    var label = this.label = document.createElement('span');
    label.textContent = localizedName;
    wrapper.appendChild(label);
    this.applyOverflowTextMask();
    icon.appendChild(wrapper);
    container.appendChild(icon);
    if (descriptor.removable === true) {
      this.appendOptions();
    }
    target.appendChild(container);
    if (this.downloading) {
      container.style.visibility = 'visible';
      icon.classList.add('loading');
    }
  }
function icon_render ( target ) { var container = this . container = document . createElement ( 'li' ) ; container . className = 'icon' ; if ( this . descriptor . hidden ) { delete this . descriptor . hidden ; container . dataset . visible = false ; } var descriptor = this . descriptor ; container . dataset . isIcon = true ; this . _descriptorIdentifiers . forEach ( function ( prop ) { var value = descriptor [ prop ] ; if ( value ) container . dataset [ prop ] = value ; } ) ; var localizedName = descriptor . localizedName || descriptor . name ; container . setAttribute ( 'role' , 'button' ) ; container . setAttribute ( 'aria-label' , localizedName ) ; var icon = this . icon = document . createElement ( 'div' ) ; var img = this . img = new Image ( ) ; img . setAttribute ( 'role' , 'presentation' ) ; img . width = MAX_ICON_SIZE + ICON_PADDING_IN_CANVAS ; img . height = MAX_ICON_SIZE + ICON_PADDING_IN_CANVAS ; img . style . visibility = 'hidden' ; if ( descriptor . renderedIcon ) { this . displayRenderedIcon ( ) ; } else { this . fetchImageData ( ) ; } icon . appendChild ( img ) ; var wrapper = document . createElement ( 'span' ) ; wrapper . className = 'labelWrapper' ; var label = this . label = document . createElement ( 'span' ) ; label . textContent = localizedName ; wrapper . appendChild ( label ) ; this . applyOverflowTextMask ( ) ; icon . appendChild ( wrapper ) ; container . appendChild ( icon ) ; if ( descriptor . removable === true ) { this . appendOptions ( ) ; } target . appendChild ( container ) ; if ( this . downloading ) { container . style . visibility = 'visible' ; icon . classList . add ( 'loading' ) ; } }
Renders the icon into the page
 @param{Object} where the icon should be rendered
Renders the icon into the page @param { Object } where the icon should be rendered
/*
     * <li role="button" aria-label="label" class="icon" data-manifestURL="zzz">
     *   <div>
     *     <img role="presentation" src="the icon image path"></img>
     *     <span class="label">label</span>
     *   </div>
     *   <span class="options"></span>
     * </li>
     */ // Icon container // Image // Label // wrapper of the label -> overflow text should be centered // in draggable mode //XXX: Bug 816043 We need to force the repaint to show the span // with the label and the animation (associated to the span)