code: function (elements, attribute) {
              var foundElements = {};
              for (i = 0; i < elements.length; i++) {
                  var attributeValues = elements[i].getAttribute(attribute);
                  if (attributeValues === undefined || attributeValues === null)
                      continue;
                      // Elements can have multiple attribute values,
                      // the string should be delimited by a comma.
                      attributeValues = this.splitStringByComma(attributeValues);
                      for (var x = 0; x < attributeValues.length; x++) {
                          // The attribute value will also serve as the
                          // key in the object that will be returned.
                          var key = attributeValues[x];
                          if (key === undefined || key === null)
                              continue;
                          // The key must exist in the element as an
                          // array, otherwise push() will fail.
                          if (foundElements[key] === undefined || foundElements[key].constructor !== Array)
                              foundElements[key] = [];
                              foundElements[key].push(elements[i]);
                      }
                  }
  
              return foundElements;
          }
docs: Find elements by attribute name, and return
  them as an object with attribute value as key.
  This method will sort elements in different
  objects, depending on attributes. An element
  with multiple attribute values will be added
  to multiple objects.
  
  @param       elements    Array of elements to search
  @param       string      Attribute to find
  @returns     object      List of elements found