2 * Copyright 2009 The Closure Compiler Authors
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @fileoverview Definitions for all iPhone extensions. Created from:
18 * http://developer.apple.com/library/safari/navigation/
21 * @author agrieve@google.com (Andrew Grieve)
25 * The Touch class represents a single touch on the surface. A touch is the
26 * presence or movement of a finger that is part of a unique multi-touch
28 * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchClassReference/Touch/Touch.html
34 * The x-coordinate of the touch's location relative to the window's viewport.
37 Touch.prototype.clientX;
40 * The y-coordinate of the touch's location relative to the window's viewport.
43 Touch.prototype.clientY;
46 * The unique identifier for this touch object.
49 Touch.prototype.identifier;
52 * The x-coordinate of the touch's location in page coordinates.
55 Touch.prototype.pageX;
58 * The y-coordinate of the touch's location in page coordinates.
61 Touch.prototype.pageY;
64 * The x-coordinate of the touch's location in screen coordinates.
67 Touch.prototype.screenX;
70 * The y-coordinate of the touch's location in screen coordinates.
73 Touch.prototype.screenY;
76 * The target of this touch.
79 Touch.prototype.target;
82 * Creates a new Touch object.
83 * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html#//apple_ref/javascript/instm/Document/createTouch
84 * @param {Window} view
85 * @param {EventTarget} target
86 * @param {number} identifier
87 * @param {number} pageX
88 * @param {number} pageY
89 * @param {number} screenX
90 * @param {number} screenY
93 Document.prototype.createTouch = function(view, target, identifier, pageX,
94 pageY, screenX, screenY) {};
97 * The TouchList class is used to represent a collection of Touch objects.
98 * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchListClassReference/TouchList/TouchList.html
101 function TouchList() {}
104 * The number of Touch objects in this TouchList object.
107 TouchList.prototype.length;
110 * Returns the Touch object at the given index.
111 * @param {number} index
114 TouchList.prototype.item = function(index) {};
117 * Creates a new TouchList object.
118 * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html#//apple_ref/javascript/instm/Document/createTouchList
119 * @param {Array.<Touch>} touches
120 * @return {TouchList}
122 Document.prototype.createTouchList = function(touches) {};
125 * The TouchEvent class encapsulates information about a touch event.
127 * <p>The system continually sends TouchEvent objects to an application as
128 * fingers touch and move across a surface. A touch event provides a snapshot of
129 * all touches during a multi-touch sequence, most importantly the touches that
130 * are new or have changed for a particular target. A multi-touch sequence
131 * begins when a finger first touches the surface. Other fingers may
132 * subsequently touch the surface, and all fingers may move across the surface.
133 * The sequence ends when the last of these fingers is lifted from the surface.
134 * An application receives touch event objects during each phase of any touch.
137 * <p>The different types of TouchEvent objects that can occur are:
139 * <li>touchstart - Sent when a finger for a given event touches the surface.
140 * <li>touchmove - Sent when a given event moves on the surface.
141 * <li>touchend - Sent when a given event lifts from the surface.
142 * <li>touchcancel - Sent when the system cancels tracking for the touch.
144 * TouchEvent objects are combined together to form high-level GestureEvent
145 * objects that are also sent during a multi-touch sequence.</p>
147 * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchEventClassReference/TouchEvent/TouchEvent.html
151 function TouchEvent() {}
154 * A collection of Touch objects representing all touches associated with this
158 TouchEvent.prototype.touches;
161 * A collection of Touch objects representing all touches associated with this
165 TouchEvent.prototype.targetTouches;
168 * A collection of Touch objects representing all touches that changed in this event.
171 TouchEvent.prototype.changedTouches;
174 * The distance between two fingers since the start of an event as a multiplier
175 * of the initial distance. The initial value is 1.0. If less than 1.0, the
176 * gesture is pinch close (to zoom out). If greater than 1.0, the gesture is
177 * pinch open (to zoom in).
180 TouchEvent.prototype.scale;
183 * The delta rotation since the start of an event, in degrees, where clockwise
184 * is positive and counter-clockwise is negative. The initial value is 0.0.
187 TouchEvent.prototype.rotation;
190 * Initializes a newly created TouchEvent object.
191 * @param {string} type
192 * @param {boolean} canBubble
193 * @param {boolean} cancelable
194 * @param {Window} view
195 * @param {number} detail
196 * @param {number} screenX
197 * @param {number} screenY
198 * @param {number} clientX
199 * @param {number} clientY
200 * @param {boolean} ctrlKey
201 * @param {boolean} altKey
202 * @param {boolean} shiftKey
203 * @param {boolean} metaKey
204 * @param {TouchList} touches
205 * @param {TouchList} targetTouches
206 * @param {TouchList} changedTouches
207 * @param {number} scale
208 * @param {number} rotation
210 TouchEvent.prototype.initTouchEvent = function(type, canBubble, cancelable,
211 view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
212 metaKey, touches, targetTouches, changedTouches, scale, rotation) {};
215 * The GestureEvent class encapsulates information about a multi-touch gesture.
217 * GestureEvent objects are high-level events that encapsulate the low-level
218 * TouchEvent objects. Both GestureEvent and TouchEvent events are sent during
219 * a multi-touch sequence. Gesture events contain scaling and rotation
220 * information allowing gestures to be combined, if supported by the platform.
221 * If not supported, one gesture ends before another starts. Listen for
222 * GestureEvent events if you want to respond to gestures only, not process
223 * the low-level TouchEvent objects.
225 * @see http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/GestureEventClassReference/GestureEvent/GestureEvent.html
229 function GestureEvent() {}
232 * The distance between two fingers since the start of an event as a multiplier
233 * of the initial distance. The initial value is 1.0. If less than 1.0, the
234 * gesture is pinch close (to zoom out). If greater than 1.0, the gesture is
235 * pinch open (to zoom in).
238 GestureEvent.prototype.scale;
241 * The delta rotation since the start of an event, in degrees, where clockwise
242 * is positive and counter-clockwise is negative. The initial value is 0.0.
245 GestureEvent.prototype.rotation;
248 * The target of this gesture.
249 * @type {EventTarget}
251 GestureEvent.prototype.target;
254 * Initializes a newly created GestureEvent object.
255 * @param {string} type
256 * @param {boolean} canBubble
257 * @param {boolean} cancelable
258 * @param {Window} view
259 * @param {number} detail
260 * @param {number} screenX
261 * @param {number} screenY
262 * @param {number} clientX
263 * @param {number} clientY
264 * @param {boolean} ctrlKey
265 * @param {boolean} altKey
266 * @param {boolean} shiftKey
267 * @param {boolean} metaKey
268 * @param {EventTarget} target
269 * @param {number} scale
270 * @param {number} rotation
272 GestureEvent.prototype.initGestureEvent = function(type, canBubble, cancelable,
273 view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
274 metaKey, target, scale, rotation) {};
277 * Specifies the JavaScript method to invoke when the system cancels tracking
279 * @type {?function(!TouchEvent)}
281 Element.prototype.ontouchcancel;
284 * Specifies the JavaScript method to invoke when a given event lifts from the
286 * @type {?function(!TouchEvent)}
288 Element.prototype.ontouchend;
291 * Specifies the JavaScript method to invoke when a finger for a given event
292 * moves on the surface.
293 * @type {?function(!TouchEvent)}
295 Element.prototype.ontouchmove;
298 * Specifies the JavaScript method to invoke when a finger for a given event
299 * touches the surface.
300 * @type {?function(!TouchEvent)}
302 Element.prototype.ontouchstart;
305 * Specifies the JavaScript method to invoke when a gesture is started by
306 * two or more fingers touching the surface.
307 * @type {?function(!GestureEvent)}
309 Element.prototype.ongesturestart;
312 * Specifies the JavaScript method to invoke when fingers are moved during a
314 * @type {?function(!GestureEvent)}
316 Element.prototype.ongesturechange;
319 * Specifies the JavaScript method to invoke when a gesture ends (when there are
320 * 0 or 1 fingers touching the surface).
321 * @type {?function(!GestureEvent)}
323 Element.prototype.ongestureend;
326 * Specifies the JavaScript method to invoke when the browser device's
327 * orientation changes, i.e.the device is rotated.
328 * @type {?function(!Event)}
329 * @see http://developer.apple.com/library/IOS/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
331 Window.prototype.onorientationchange;
334 * Returns the orientation of the browser's device, one of [-90, 0, 90, 180].
336 * @see http://developer.apple.com/library/IOS/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
338 Window.prototype.orientation;
344 HTMLInputElement.prototype.autocorrect;
350 HTMLInputElement.prototype.autocapitalize;
356 HTMLTextAreaElement.prototype.autocorrect;
362 HTMLTextAreaElement.prototype.autocapitalize;