You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Volker Weber (JIRA)" <de...@myfaces.apache.org> on 2013/10/16 11:23:48 UTC

[jira] [Created] (TOBAGO-1325) jQuery to slow in IE8: Tobago.Util.selectWithJQuery()

Volker Weber created TOBAGO-1325:
------------------------------------

             Summary: jQuery to slow in IE8: Tobago.Util.selectWithJQuery()
                 Key: TOBAGO-1325
                 URL: https://issues.apache.org/jira/browse/TOBAGO-1325
             Project: MyFaces Tobago
          Issue Type: Improvement
          Components: Themes
    Affects Versions: 2.0.0-alpha-2
         Environment: IE8
            Reporter: Volker Weber
            Assignee: Udo Schnurpfeil


Following changes to selectWidthJQuery improves performance in IE8 at 300 times.

{code}

Tobago.Utils.selectWidthJQuery = function(elements, selector) {
  if (Tobago.browser.isMsie678 && elements != null
      && (selector.match(/^\[[-_a-zA-Z0-9]+\]$/) || selector == "input, select, textarea, a, button")) {
    var founds = new Array();
    if (selector.match(/^\[[-_a-zA-Z0-9]+\]$/)) {
      Tobago.Utils.ieFilterAttributes(elements.get(0), selector.substr(1, selector.length - 2), founds);
    } else if (selector == "input, select, textarea, a, button") {
      Tobago.Utils.ieFilterTags(elements.get(0), "INPUT", founds);
      Tobago.Utils.ieFilterTags(elements.get(0), "SELECT", founds);
      Tobago.Utils.ieFilterTags(elements.get(0), "TEXTAREA", founds);
      Tobago.Utils.ieFilterTags(elements.get(0), "A", founds);
      Tobago.Utils.ieFilterTags(elements.get(0), "BUTTON", founds);
    }
    return jQuery(founds);
  } else {
    return elements == null
        ? jQuery(selector)
        : elements.find(selector).add(elements.filter(selector));
  }
};

Tobago.Utils.ieFilterTags = function (element, tagName, result) {
  if (element.tagName == tagName) {
    result.push(element);
  }
  for (var i = 0; i < element.childNodes.length; i++) {
    Tobago.Utils.ieFilterTags(element.childNodes[i], tagName, result);
  }
};

Tobago.Utils.ieFilterAttributes = function (element, filter, result) {
  if (element[filter] !== undefined) {
    result.push(element);
  }
  for (var i = 0; i < element.childNodes.length; i++) {
    Tobago.Utils.ieFilterAttributes(element.childNodes[i], filter, result);
  }
};
{code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)