added commentary on selector perf and whitespace

This commit is contained in:
John Bender 2011-12-09 12:35:02 -08:00
parent a80e4c3b4c
commit c49eac6e67

View file

@ -1,4 +1,4 @@
/*
/*
* "core" - The base file for jQm
*/
@ -152,7 +152,7 @@
}
e = e.parentNode;
}
// Return the theme letter we found, if none, return the
// specified default.
@ -160,11 +160,13 @@
}
});
// TODO the following $ and $.fn extensions can/probably should be moved into
// jquery.mobile.core.helpers
// Find the closest javascript page element to gather settings data
// TODO complex selector parsing will slow down page load times
// TODO the following $ and $.fn extensions can/probably should be moved into jquery.mobile.core.helpers
//
// Find the closest javascript page element to gather settings data jsperf test
// http://jsperf.com/single-complex-selector-vs-many-complex-selectors/edit
// possibly naive, but it shows that the parsing overhead for *just* the page selector vs
// the page and dialog selector is negligable. This could probably be speed up by
// doing a similar parent node traversal to the one found in the inherited theme code above
$.fn.closestPageData = function() {
return $(this)
.closest(':jqmData(role="page"), :jqmData(role="dialog")')