Estoy utilizando el doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Y cuando cuando ejecuto el javascript en IE lo ralentiza mucho, alguna idea??
Código:
(function($) { var ajax = $.ajax; var pendingRequests = {}; var synced = []; var syncedData = []; var valueSelected = false; $.ajax = function(settings) { // create settings for compatibility with ajaxSetup settings = jQuery.extend(settings, jQuery.extend({}, jQuery.ajaxSettings, settings)); var port = settings.port; switch (settings.mode) { case "sync": var pos = synced.length; synced[pos] = { error: settings.error, success: settings.success, complete: settings.complete, done: false }; syncedData[pos] = { error: [], success: [], complete: [] }; settings.error = function() { syncedData[pos].error = arguments; }; settings.success = function() { syncedData[pos].success = arguments; }; settings.complete = function() { syncedData[pos].complete = arguments; synced[pos].done = true; if (pos == 0 || !synced[pos - 1]) for (var i = pos; i < synced.length && synced[i].done; i++) { if (synced[i].error) synced[i].error.apply(jQuery, syncedData[i].error); if (synced[i].success) synced[i].success.apply(jQuery, syncedData[i].success); if (synced[i].complete) synced[i].complete.apply(jQuery, syncedData[i].complete); synced[i] = null; syncedData[i] = null; } }; } return ajax.apply(this, arguments); }; })(jQuery); jQuery.autocomplete = function (input, options) { // Create a link to self var me = this; var resultHidden = true; var currentAjax = null; // Create jQuery object for input element var $input = $(input).attr("autocomplete", "off"); // Apply inputClass if necessary if (options.inputClass) { $input.addClass(options.inputClass); } // Create results var results = document.createElement("div"); // Create jQuery object for results var $results = $(results).hide().addClass(options.resultsClass).css("position", "absolute"); if (options.width > 0) { $results.css("width", options.width); } if ($.browser.msie) { // we put a styled iframe behind the calendar so HTML SELECT elements don't show through $results.append(document.createElement('iframe')); } // Add to body element if (options.attachedToBody) { $("body").append(results); } else { $input.parent().append(results); } input.autocompleter = me; var timeout = null; var prev = ""; var active = -1; var keyb = false; var hasFocus = true; var lastKeyPressCode = null; var mouseDownOnSelect = false; var hidingResults = false; var xAdj = 0; if ($.browser.msie) { xAdj = 1; } $input.bind(($.browser.opera ? "" : "keydown") + ".autocomplete", function (e) { //$input //.keydown(function(e) { // track last key pressed lastKeyPressCode = e.keyCode; switch (e.keyCode) { case 38: // up e.preventDefault(); moveSelect(-1); break; case 40: // down e.preventDefault(); moveSelect(1); break; case 9: // tab case 13: // return /*if (!$results.is(":visible")) { return; }*/ if (selectCurrent()) { // make sure to blur off the current field valueSelected = true; $input.get(0).blur(); e.preventDefault(); } break; case 37: //left moveSelect(-1); break; case 39: //right moveSelect(1); break; case 8: //backspace need to throttle active = -1; if (timeout) clearTimeout(timeout); timeout = setTimeout(function () { onChange(); }, 100); break; default: active = -1; if (timeout) clearTimeout(timeout); timeout = setTimeout(function () { onChange(); }, options.delay); break; } }) .focus(function () { // track whether the field has focus, we shouldn't process any results if the field no longer has focus hasFocus = true; }) .blur(function () { //If only 1 result then always autoselect if (options.selectOnly) { var $li = $("li", results); if ($li.length == 1) { li = $li[0]; selectItem(li, { eventType: "blur" }); } } // track whether the field has focus hasFocus = false; if (!mouseDownOnSelect) { hideResults(); } }); hideResultsNow(); function onChange() { // ignore if the following keys are pressed: [del] [shift] [capslock] valueSelected = false; if (lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32)) return $results.hide(); var v = $input.val(); if (v == prev) return; prev = v; if (v.length >= options.minChars) { resultHidden = false; requestData(v); } else { resultHidden = true; $results.hide(); } }; function moveSelect(step) { var lis = $("li", results); if (!lis) return; active += step; if (active < 0) { active = 0; } else if (active >= lis.size()) { active = lis.size() - 1; } lis.removeClass("ac_over"); $(lis[active]).addClass("ac_over"); }; function selectCurrent() { var li = $("li.ac_over", results)[0]; if (!li) { var $li = $("li", results); if (options.selectOnly) { if ($li.length == 1) li = $li[0]; } else if (options.selectFirst) { li = $li[0]; } } if (li) { if (li.selectValue.toLowerCase().substring(0, $input.val().length) != $input.val().toLowerCase()) { return false; } selectItem(li); return true; } else { return false; } };