Uploaded image for project: 'MyFaces Tobago'
  1. MyFaces Tobago
  2. TOBAGO-1325

jQuery too slow in IE8: Tobago.Util.selectWithJQuery()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-alpha-2
    • 2.0.5
    • Themes
    • None
    • IE8

    Description

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

      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);
        }
      };
      

      Attachments

        Activity

          People

            lofwyr Udo Schnurpfeil
            weber Volker Weber
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: