function tabView_getElement(aSpec) {
    var spec = aSpec || { };
    var type = spec.type;
    var subtype = spec.subtype;
    var value = spec.value;
    var parent = spec.parent;

    var root = parent ? parent.getNode() : this._tabViewDoc;
    var nodeCollector = new domUtils.nodeCollector(root);

    switch(type) {
      // Top level elements
      case "tabView":
        nodeCollector.root = this._controller.window.document;
        nodeCollector.queryNodes("#tab-view");
        break;
      case "contentArea":
        nodeCollector.queryNodes("#content");
        break;
      case "deck":
        nodeCollector.root = this._controller.window.document;
        nodeCollector.queryNodes("#tab-view-deck");
        break;
      case "exitButton":
        nodeCollector.queryNodes("#exit-button");
        break;

      // Group elements
      case "group_appTabs":
        nodeCollector.queryNodes(".groupItem .appTabIcon");
        break;
      case "group_closeButton":
        nodeCollector.queryNodes(".groupItem .close");
        break;
      case "group_newTabButton":
        nodeCollector.queryNodes(".groupItem .newTabButton");
        break;
      case "group_resizer":
        nodeCollector.queryNodes(".groupItem .iq-resizable-handle");
        break;
      case "group_stackExpander":
        nodeCollector.queryNodes(".groupItem .stackExpander");
        break;
      case "group_titleBox":
        nodeCollector.queryNodes(".groupItem .name");
        break;
      case "group_undoButton":
        // Bug 596504 - No reference to the undo button
        nodeCollector.root = this._tabViewDoc;
        nodeCollector.queryNodes(".undo").filter(function(node) {
          var groups = this._groupItemsObject.groupItems;
          for (var i = 0; i < groups.length; i++) {
            var group = groups[i];
            if (group.container == aSpec.value.getNode() &&
                group.$undoContainer.length == 1) {
              return true;
            }
          }
          return false;
        }, this);
        break;
      case "groups":
        nodeCollector.queryNodes(".groupItem").filter(function(node) {
          switch(subtype) {
            case "active":
              return node.className.indexOf("activeGroup") != -1;
            case "title":
              // If no title is given the default name is used
              if (!value) {
                value = utils.getProperty("chrome://browser/locale/tabview.properties",
                                  "tabview.groupItem.defaultName");
              }
              var title = node.querySelector(".name");
              return (value == title.value);
            default:
              return true;
          }
        }, this);
        break;

      // Search elements
      case "search_box":
        nodeCollector.queryNodes("#searchbox");
        break;
      case "search_button":
        nodeCollector.queryNodes("#searchbutton");
        break;

      // Tab elements
      case "tab_closeButton":
        nodeCollector.queryNodes(".tab .close");
        break;
      case "tab_favicon":
        nodeCollector.queryNodes(".tab .favicon");
        break;
      case "tab_titleBox":
        nodeCollector.queryNodes(".tab .tab-title");
        break;
      case "tabs":
        nodeCollector.queryNodes(".tab").filter(function(node) {
          switch (subtype) {
            case "active":
              return (node.className.indexOf("focus") != -1);
            case "group":
              var group = value ? value.getNode() : null;
              if (group) {
                var tabs = this._tabItemsObject.getItems();
                for (var i = 0; i < tabs.length; i++) {
                  var tab = tabs[i];
                  if (tab.parent && tab.parent.container == group) {
                    return true;
                  }
                }
                return false;
              } else {
                return (node.className.indexOf("tabInGroupItem") == -1);
              }
            default:
              return true;
          }
        }, this);
        break;
      default:
        throw new Error(arguments.callee.name + ": Unknown element type - " +
                        aSpec.type);
    }

    return nodeCollector.elements;
  }
function tabView_getElement(aSpec) {
    var spec = aSpec || { };
    var type = spec.type;
    var subtype = spec.subtype;
    var value = spec.value;
    var parent = spec.parent;

    var root = parent ? parent.getNode() : this._tabViewDoc;
    var nodeCollector = new domUtils.nodeCollector(root);

    switch(type) {
      // Top level elements
      case "tabView":
        nodeCollector.root = this._controller.window.document;
        nodeCollector.queryNodes("#tab-view");
        break;
      case "contentArea":
        nodeCollector.queryNodes("#content");
        break;
      case "deck":
        nodeCollector.root = this._controller.window.document;
        nodeCollector.queryNodes("#tab-view-deck");
        break;
      case "exitButton":
        nodeCollector.queryNodes("#exit-button");
        break;

      // Group elements
      case "group_appTabs":
        nodeCollector.queryNodes(".groupItem .appTabIcon");
        break;
      case "group_closeButton":
        nodeCollector.queryNodes(".groupItem .close");
        break;
      case "group_newTabButton":
        nodeCollector.queryNodes(".groupItem .newTabButton");
        break;
      case "group_resizer":
        nodeCollector.queryNodes(".groupItem .iq-resizable-handle");
        break;
      case "group_stackExpander":
        nodeCollector.queryNodes(".groupItem .stackExpander");
        break;
      case "group_titleBox":
        nodeCollector.queryNodes(".groupItem .name");
        break;
      case "group_undoButton":
        // Bug 596504 - No reference to the undo button
        nodeCollector.root = this._tabViewDoc;
        nodeCollector.queryNodes(".undo").filter(function(node) {
          var groups = this._groupItemsObject.groupItems;
          for (var i = 0; i < groups.length; i++) {
            var group = groups[i];
            if (group.container == aSpec.value.getNode() &&
                group.$undoContainer.length == 1) {
              return true;
            }
          }
          return false;
        }, this);
        break;
      case "groups":
        nodeCollector.queryNodes(".groupItem").filter(function(node) {
          switch(subtype) {
            case "active":
              return node.className.indexOf("activeGroup") != -1;
            case "title":
              // If no title is given the default name is used
              if (!value) {
                value = utils.getProperty("chrome://browser/locale/tabview.properties",
                                  "tabview.groupItem.defaultName");
              }
              var title = node.querySelector(".name");
              return (value == title.value);
            default:
              return true;
          }
        }, this);
        break;

      // Search elements
      case "search_box":
        nodeCollector.queryNodes("#searchbox");
        break;
      case "search_button":
        nodeCollector.queryNodes("#searchbutton");
        break;

      // Tab elements
      case "tab_closeButton":
        nodeCollector.queryNodes(".tab .close");
        break;
      case "tab_favicon":
        nodeCollector.queryNodes(".tab .favicon");
        break;
      case "tab_titleBox":
        nodeCollector.queryNodes(".tab .tab-title");
        break;
      case "tabs":
        nodeCollector.queryNodes(".tab").filter(function(node) {
          switch (subtype) {
            case "active":
              return (node.className.indexOf("focus") != -1);
            case "group":
              var group = value ? value.getNode() : null;
              if (group) {
                var tabs = this._tabItemsObject.getItems();
                for (var i = 0; i < tabs.length; i++) {
                  var tab = tabs[i];
                  if (tab.parent && tab.parent.container == group) {
                    return true;
                  }
                }
                return false;
              } else {
                return (node.className.indexOf("tabInGroupItem") == -1);
              }
            default:
              return true;
          }
        }, this);
        break;
      default:
        throw new Error(arguments.callee.name + ": Unknown element type - " +
                        aSpec.type);
    }

    return nodeCollector.elements;
  }
function tabView_getElement ( aSpec ) { var spec = aSpec || { } ; var type = spec . type ; var subtype = spec . subtype ; var value = spec . value ; var parent = spec . parent ; var root = parent ? parent . getNode ( ) : this . _tabViewDoc ; var nodeCollector = new domUtils . nodeCollector ( root ) ; switch ( type ) { // Top level elements case "tabView" : nodeCollector . root = this . _controller . window . document ; nodeCollector . queryNodes ( "#tab-view" ) ; break ; case "contentArea" : nodeCollector . queryNodes ( "#content" ) ; break ; case "deck" : nodeCollector . root = this . _controller . window . document ; nodeCollector . queryNodes ( "#tab-view-deck" ) ; break ; case "exitButton" : nodeCollector . queryNodes ( "#exit-button" ) ; break ; // Group elements case "group_appTabs" : nodeCollector . queryNodes ( ".groupItem .appTabIcon" ) ; break ; case "group_closeButton" : nodeCollector . queryNodes ( ".groupItem .close" ) ; break ; case "group_newTabButton" : nodeCollector . queryNodes ( ".groupItem .newTabButton" ) ; break ; case "group_resizer" : nodeCollector . queryNodes ( ".groupItem .iq-resizable-handle" ) ; break ; case "group_stackExpander" : nodeCollector . queryNodes ( ".groupItem .stackExpander" ) ; break ; case "group_titleBox" : nodeCollector . queryNodes ( ".groupItem .name" ) ; break ; case "group_undoButton" : // Bug 596504 - No reference to the undo button nodeCollector . root = this . _tabViewDoc ; nodeCollector . queryNodes ( ".undo" ) . filter ( function ( node ) { var groups = this . _groupItemsObject . groupItems ; for ( var i = 0 ; i < groups . length ; i ++ ) { var group = groups [ i ] ; if ( group . container == aSpec . value . getNode ( ) && group . $undoContainer . length == 1 ) { return true ; } } return false ; } , this ) ; break ; case "groups" : nodeCollector . queryNodes ( ".groupItem" ) . filter ( function ( node ) { switch ( subtype ) { case "active" : return node . className . indexOf ( "activeGroup" ) != - 1 ; case "title" : // If no title is given the default name is used if ( ! value ) { value = utils . getProperty ( "chrome://browser/locale/tabview.properties" , "tabview.groupItem.defaultName" ) ; } var title = node . querySelector ( ".name" ) ; return ( value == title . value ) ; default : return true ; } } , this ) ; break ; // Search elements case "search_box" : nodeCollector . queryNodes ( "#searchbox" ) ; break ; case "search_button" : nodeCollector . queryNodes ( "#searchbutton" ) ; break ; // Tab elements case "tab_closeButton" : nodeCollector . queryNodes ( ".tab .close" ) ; break ; case "tab_favicon" : nodeCollector . queryNodes ( ".tab .favicon" ) ; break ; case "tab_titleBox" : nodeCollector . queryNodes ( ".tab .tab-title" ) ; break ; case "tabs" : nodeCollector . queryNodes ( ".tab" ) . filter ( function ( node ) { switch ( subtype ) { case "active" : return ( node . className . indexOf ( "focus" ) != - 1 ) ; case "group" : var group = value ? value . getNode ( ) : null ; if ( group ) { var tabs = this . _tabItemsObject . getItems ( ) ; for ( var i = 0 ; i < tabs . length ; i ++ ) { var tab = tabs [ i ] ; if ( tab . parent && tab . parent . container == group ) { return true ; } } return false ; } else { return ( node . className . indexOf ( "tabInGroupItem" ) == - 1 ) ; } default : return true ; } } , this ) ; break ; default : throw new Error ( arguments . callee . name + ": Unknown element type - " + aSpec . type ) ; } return nodeCollector . elements ; }
Retrieve list of UI elements based on the given specification

@param {object} aSpec
Information of the UI elements which should be retrieved
Elements: type     - Identifier of the element
subtype  - Attribute of the element to filter
[optional - default: ""]
value    - Value of the attribute to filter
[optional - default: ""]
parent   - Parent of the to find element
[optional - default: document]

@returns Elements which have been found
@type {array of ElemBase}
Retrieve list of UI elements based on the given specification
Returns the element that contains the specified tabView element.