Despite removing all my code from $.Ready(), it appears that jquery.validate.unobtrusive.js is calling some heafty on load code which is resulting in a 300ms lead-time for our DOMContentLoaded event to fire.
We do have a pretty large DOM, but surely it shouldn’t take that long?
Whilst tackling some performance dragons on a product I am working on, it appeared that my DOMContentLoaded event was taking 700ms in IE 9 (We have a pretty big DOM – which is also on my list to tackle)
After disabling all my OnReady code – I narrowed it down
parse(selector)injquery.validate.unobtrusive.jsAfter finding:
$(selector).find(":input[data-val=true]").each(function () {...}I knew immediately the structure of the selector in the Find() method, that this would go into the sizzle engine, and not use theDocument.QuerySelectorAll().–Edit as per comment from @CharlesC–
A minor change of the selector to:
$(selector).find("input, select, textarea").filter("[data-val=true]")resulted in a 300ms performance gain within IE.