Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit c49eac6

Browse files
committed
added commentary on selector perf and whitespace
1 parent a80e4c3 commit c49eac6

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

js/jquery.mobile.core.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* "core" - The base file for jQm
33
*/
44

@@ -152,19 +152,21 @@
152152
}
153153
e = e.parentNode;
154154
}
155-
155+
156156
// Return the theme letter we found, if none, return the
157157
// specified default.
158158

159159
return ltr || defaultTheme || "a";
160160
}
161161
});
162162

163-
// TODO the following $ and $.fn extensions can/probably should be moved into
164-
// jquery.mobile.core.helpers
165-
166-
// Find the closest javascript page element to gather settings data
167-
// TODO complex selector parsing will slow down page load times
163+
// TODO the following $ and $.fn extensions can/probably should be moved into jquery.mobile.core.helpers
164+
//
165+
// Find the closest javascript page element to gather settings data jsperf test
166+
// http://jsperf.com/single-complex-selector-vs-many-complex-selectors/edit
167+
// possibly naive, but it shows that the parsing overhead for *just* the page selector vs
168+
// the page and dialog selector is negligable. This could probably be speed up by
169+
// doing a similar parent node traversal to the one found in the inherited theme code above
168170
$.fn.closestPageData = function() {
169171
return $(this)
170172
.closest(':jqmData(role="page"), :jqmData(role="dialog")')

0 commit comments

Comments
 (0)