The jquery statement
$(selector).find(":input[data-val=true]").each(....) - line 173 jquery.validate.unobtrusive.js within the Parse(selector) method.
Provides better performance if it is re-written as a chained statement, oppose to as a single selector:
$(selector).find("input").filter["data-val=true]").each(..)
This is because it allows JQuery to use less of the Sizzle engine (which is known to be poor). On a large DOM, it has shown performance improvements of an order of magnitude firing the DOMContentLoaded event.
We have reduced the duration of our Document ready method from 700ms to 300ms.
Thanks,
Comments: There seems to be a difference in logic between the two. The original is using the ":input" selector, whereas the fix is using "input" (without the colon). This would mean that in the new situation textareas, selects and buttons are not included in the selection, which it does do in the original code. I have not measured the performance implication of adding back the colon.
$(selector).find(":input[data-val=true]").each(....) - line 173 jquery.validate.unobtrusive.js within the Parse(selector) method.
Provides better performance if it is re-written as a chained statement, oppose to as a single selector:
$(selector).find("input").filter["data-val=true]").each(..)
This is because it allows JQuery to use less of the Sizzle engine (which is known to be poor). On a large DOM, it has shown performance improvements of an order of magnitude firing the DOMContentLoaded event.
We have reduced the duration of our Document ready method from 700ms to 300ms.
Thanks,
Comments: There seems to be a difference in logic between the two. The original is using the ":input" selector, whereas the fix is using "input" (without the colon). This would mean that in the new situation textareas, selects and buttons are not included in the selection, which it does do in the original code. I have not measured the performance implication of adding back the colon.