Commit graph

1051 commits

Author SHA1 Message Date
Todd Parker
c2e65107c0 Merged pull request #1503 from eddiemonge/eddie_listview.
micro-optimizations and styling changes to listview.js
2011-04-27 13:34:39 -07:00
scottjehl
7c8f8e9406 updated jQuery to 1.6 RC 2011-04-27 07:53:59 -07:00
Kin Blas
52a666d71f Check $from before dereferencing it. 2011-04-26 16:36:31 -07:00
Kin Blas
19c06952fd Changes to allow 3rd party transitions. Developers can now register a custom transition by adding their transition handler to the $.mobile.transitionHandlers dictionary. The name of the custom transition is used as the key within the transtionsHandlers dictionary, and should be the same name used within the @data-transtion attribute.
The expected prototype for a transitionHandler is as follows:

function handler(name, reverse, $to, $from)

The name parameter is the name of the transition as specified by @data-transition attribute, reverse is a boolean that is false for a normal transition, and true for a reverse transition. The $to param is a jQuery collection containing the page that is being transitioned "to", and $from is an optional collection that tells us what page we are transitioning "from". Because $from is optional, handler developers should take care and check $from to make sure it is not undefined before attempting to dereference it.

In addition to registering custom transition by name, developers can specify a handler to use in the case where a transition name is specified and does not exist within the $.mobile.transitionHanlders dictionary. Within jQuery Mobile, the default handler for unknown transition types is the $.mobile.css3Transition() handler. This handler always assumes that the transition name is to be used as a CSS class to be placed on the $to and $from elements. To change the default handler, simply set $.mobile.defaultTransitionHandler to you function handler:

$.mobile.defaultTransitionHandler = myTransitionHandler;

The changes to make all this necessary are as follows:

- Created $.mobile.noneTransitionHandler which is the default transitionHandler for the framework that simply adds and removes the page active class on the $from and $to pages with no animations.

- Moved class based transition code into a new plugin jquery.mobile.transition.js file. This plugin, when present, overrides the noneTransitionHandler as the defaultTranstionHandler for the framework so that CSS3 animation transitions are available.

- Removed code related to the setting/removal of the ui-mobile-viewport-perspective class. The css3TransitionHandler plugin takes care of automatically placing a "viewport-<transition name>" class on the viewport (body) element. This allows any other transition to specify properties on the viewport that are necessary to accomplish the transition.

- changed the CSS class ui-mobile-viewport-perspective to viewport-flip to match code changes. This makes it more apparent that setting -webkit-perspective is only used with the flip transition.

- Updated js/index.php, Makefile and build.xml to include the new jquery.mobile.transition.js file.
2011-04-26 14:06:10 -07:00
Kin Blas
14f73b27ee Changes to allow 3rd party transitions. Developers can now register a custom transition by adding their transition handler to the $.mobile.transitionHandlers dictionary. The name of the custom transition is used as the key within the transtionsHandlers dictionary, and should be the same name used within the @data-transtion attribute.
The expected prototype for a transitionHandler is as follows:

function handler(name, reverse, $to, $from)

The name parameter is the name of the transition as specified by @data-transition attribute, reverse is a boolean that is false for a normal transition, and true for a reverse transition. The $to param is a jQuery collection containing the page that is being transitioned "to", and $from is an optional collection that tells us what page we are transitioning "from". Because $from is optional, handler developers should take care and check $from to make sure it is not undefined before attempting to dereference it.

In addition to registering custom transition by name, developers can specify a handler to use in the case where a transition name is specified and does not exist within the $.mobile.transitionHanlders dictionary. Within jQuery Mobile, the default handler for unknown transition types is the $.mobile.css3Transition() handler. This handler always assumes that the transition name is to be used as a CSS class to be placed on the $to and $from elements. To change the default handler, simply set $.mobile.defaultTransitionHandler to you function handler:

$.mobile.defaultTransitionHandler = myTransitionHandler;

The changes to make all this necessary are as follows:

- Created $.mobile.noneTransitionHandler which is the default transitionHandler for the framework that simply adds and removes the page active class on the $from and $to pages with no animations.

- Moved class based transition code into a new plugin jquery.mobile.transition.js file. This plugin, when present, overrides the noneTransitionHandler as the defaultTranstionHandler for the framework so that CSS3 animation transitions are available.

- Removed code related to the setting/removal of the ui-mobile-viewport-perspective class. The css3TransitionHandler plugin takes care of automatically placing a "viewport-<transition name>" class on the viewport (body) element. This allows any other transition to specify properties on the viewport that are necessary to accomplish the transition.

- changed the CSS class ui-mobile-viewport-perspective to viewport-flip to match code changes. This makes it more apparent that setting -webkit-perspective is only used with the flip transition.

- Updated js/index.php, Makefile and build.xml to include the new jquery.mobile.transition.js file.
2011-04-26 13:53:11 -07:00
Kin Blas
3a164c6cc8 Merge branch 'master' of https://github.com/jquery/jquery-mobile 2011-04-22 10:56:55 -07:00
Kin Blas
f7749504b8 Modified the vclick handler code in navgation.js so that it doesn't place the ui-btn-active class on any links meant for interactivity.
Removed the return false in the vclick handler of collapsible and replaced it with a preventDefault(). The only reason we were returning false was to stopPropagation() so that the vclick handler in navigation.js  didn't place a ui-btn-active on it.
2011-04-22 10:53:24 -07:00
John Bender
cf23361a19 added the single call to local function focus button to ensure menu height calculation is accurate Fixes #1453 2011-04-21 22:30:39 -07:00
Kin Blas
2d2e6d7741 Fix for issue 1461 - Tops of pages missing after dialog click in Safari and iPhone.
- Delayed the setting of focus till *AFTER* the scroll position is restored.
2011-04-21 15:31:21 -07:00
eddiemonge
279d71828a left a test piece of code in previously 2011-04-21 14:40:58 -07:00
eddiemonge
d7bab1f9a5 micro-optimizations and styling changes to listview.js 2011-04-21 14:33:49 -07:00
Kin Blas
1ec80bdc80 I broke button states in my last checkin. I was passing in the wrong element (document) into the new function that finds the button element. 2011-04-21 10:56:04 -07:00
Kin Blas
d4c7b5da66 Fix from @brukhabtu for issue 1492 - Errors when trying to delete DOM elements.
- Check for existence of the bindings object before attempting to use it. Apparently jQuery core strips off any data bindings of an element before calling teardown on it to remove special event handlers.
2011-04-20 18:06:21 -07:00
John Bender
16a38a61ea fixed custom select dialog menu transition issues by preceding backward through history. This tightly couples the closing of custom select dialog menus to our hash change history implementation because of how it handles dialogs in dialogs. 2011-04-19 23:28:11 -07:00
John Bender
01c40c2525 select whitespace fixes 2011-04-19 23:28:11 -07:00
Kin Blas
7d9af0b2a8 Fix for issue 1157 - Collapsible block prevents page scrolling on iPhone 4
- When we switched to virtual mouse events, I just did a straight translation of the code that existed which basically did the collapse/expand on mouseup. In order to factor in scrolling, I needed to move that code into a vclick handler and stopPropagation() and preventDefault() to make sure the button doesn't activate.
2011-04-19 16:57:13 -07:00
John Bender
dbd68472b4 whitespace and comment fixes 2011-04-18 22:35:13 -07:00
John Bender
8e42b52767 beginning to move to absolute hashes in all cases, still some more work to do 2011-04-18 21:46:53 -07:00
Kin Blas
c31ee33a0f Fix for 1407 - Bad scroll performance since A4 on iPhone 3G
- Modified vmouse code so that it uses $.data() instead of $().data() which is significantly faster.

- Modified the navigation and buttonMarkup code so they stop using live(). The vmouse code triggers several events during the touch events, which in turn causes the underlying event code to call $.closest() with the selector used during the live() call to figure out if the event should be handled. This turns out to be very expensive, so instead, we now just bind directly to the document, and walk the DOM manually to figure out if we should handle it. This is much faster since we are avoid triggering multiple nested function calls.
2011-04-18 16:13:50 -07:00
scottjehl
472cbb1778 moved calls into one. #cleaning 2011-04-17 14:24:47 -07:00
scottjehl
b649f17d9d one call to $.type 2011-04-17 12:11:03 -07:00
Kin Blas
8c71ee5dff Fix for issue 1458 - Listview thumbnails aren't rendering correctly.
Needed to modify _itemApply() to look for the first image that is the first child of its parent. I may need to tweak this at a later point because the selector is still too general.
2011-04-14 23:36:58 -07:00
John Bender
2242684e59 added support for query params with dialog hash keys 2011-04-14 21:49:50 -07:00
John Bender
59bd1400ad check the url saved on the page element in the history stack to avoid checking agains the dialog nonsense url Fixes #1433 2011-04-14 21:49:50 -07:00
scottjehl
af7451d5ff switched to boolean check and removed the second value. Now this is only true in old webos, where it should be. 2011-04-14 18:10:22 -04:00
Kin Blas
609d1de5f4 Fix for issue 1446 - Can't drag slider in 1.0a4.1 (Android 2.1)
- Don't bind and unbind our touch listeners dynamically. This gets Android 2.1 into a strange state where it stops dispatching touch events. Instead, we now register our touchmove, touchend and scroll listeners at the same time we register our permanent touchstart listener, we then block and unblock processing in our touch listeners via a flag.
2011-04-13 15:52:51 -07:00
Kin Blas
212f9ed237 Modified _createSubPages() to reduce the number of property lookups and function calls per iteration. 2011-04-12 14:33:20 -07:00
Kin Blas
12c8c61e85 Merge branch 'master' of https://github.com/jquery/jquery-mobile 2011-04-12 13:55:15 -07:00
Kin Blas
98dc036ff0 Fix for Issue 1424 - Adding items to listviews on a4.1 is too slow
- Some optimizations to speed things up:
	- Modified _itemApply() to make use of item.children() and filters. Also got rid of some unused code.
	- Convert .each() in refresh() to a loop.
	- Cache some $list.jqmData() values so we don't do it for each list item.
2011-04-12 13:51:27 -07:00
scottjehl
c3fd9c1835 made sure a couple of variables are locally scoped. Fixes #1403 2011-04-12 15:11:14 -04:00
John Bender
aee4c631da removed stripQuery helper to reduce confusion and complexity as striping the query param from a url is much more complex than a hash as it was originally intended for 2011-04-12 01:14:05 -07:00
John Bender
a5add9a974 added handling for identical query param href/action on the same page 2011-04-12 00:58:24 -07:00
John Bender
8d3dc2cbc2 query param href/actions require absolute path prefixes when no relative path information is contained in the hash 2011-04-12 00:22:42 -07:00
John Bender
681f2a2073 handle relative query param links and forms Fixes #1160 2011-04-11 23:40:53 -07:00
John Bender
d6439d235f removed duplicate current page check in favor of fixing the off by one bug 2011-04-11 22:59:51 -07:00
John Bender
09b736a399 minor refactor from Scott's original suggestion on the issue 2011-04-10 22:59:06 -07:00
John Bender
c5ba91f0b9 navigation whitespace 2011-04-10 22:58:21 -07:00
Kin Blas
0ef954575a Fix for issues:
1333 - Delay when scrolling over list when data-theme="d"
		1368 - Listview refresh performance on a4
			1407 - Bad scroll performance since A4 on iPhone 3G

			Removed the checking for window.pageX/pageY in the vmouse touch callbacks. Accessing pageX/pageY causes the browser to flush its rendering queue.
2011-04-08 11:01:41 -07:00
scottjehl
3da5f05f75 wrapped the else if/else in an else to prevent an unnecessary dom walk until we have to make it. 2011-04-07 16:50:10 -04:00
scottjehl
97f5a9565f To ensure focus and scrollTo don't conflict (when possible), I set the focus order on page show to 1) previously clicked item if revisiting that page 2) page title 3) first focusable item in the page. Fixes #1342 2011-04-07 16:27:32 -04:00
scottjehl
b4088b9422 don't add the class to a disabled button. Fixes the checkbox test 2011-04-07 15:34:17 -04:00
scottjehl
cd0ad522ba moved the active state vclick to navigation 2011-04-07 15:28:52 -04:00
scottjehl
784f5974e5 make sure collapsibles don't have a sticky on-state. 2011-04-07 15:03:29 -04:00
scottjehl
982b7d4b15 Make navigation feel more responsive through feedback, even though it actually uses the click event again for actual page changes.
- set active state on all button vclick events
- cancelled vclick on slider switch handles so it's not too sticky.
- removed addClass in navigation.js as the first change handles it there.
2011-04-07 14:41:45 -04:00
scottjehl
9a1b2dcb3c changed name of interal function loadComplete to pageChangeComplete 2011-04-07 11:33:04 -04:00
Martin Kou
4dc2560895 Fixed yet another duplicate tap event bug. 2011-04-06 23:39:41 +08:00
John Bender
141127b903 fixed scoping issue that was causing the checkbox check to fail, tests to follow Fixes #1328 2011-04-05 23:47:34 -07:00
Kin Blas
c7aadd8a47 Fix for issue 1379 - vmouseclick or vclick?
- Changed typo "vmouseclick" to "vclick".
2011-04-05 15:57:37 -07:00
Kin Blas
600a43f746 Fix for ssue 1369 - vmouseup event has no [client/page/screen][X/Y] properties on iOS devices
- Modified createVirtualEvent to use changedTouches if touches doesn't exist.
- Also filed issue 1373 about the fact that we really need to be tracking touch identifiers in the vmouse code.
2011-04-05 10:21:54 -07:00
John Bender
05cc415f0c fix for current page links 2011-04-04 23:41:05 -07:00