@@ -21,7 +21,7 @@ <h1>Methods</h1>
21
21
< div data-role ="content ">
22
22
23
23
24
- < p > jQuery Mobile exposes several methods and properties on the $.mobile object for use in your applications.</ p >
24
+ < p > jQuery Mobile exposes several methods and properties on the $.mobile object for use in your applications.</ p >
25
25
26
26
27
27
< dl >
@@ -244,8 +244,8 @@ <h1>Methods</h1>
244
244
< strong > // Parsing the Url below results an object that is returned with the
245
245
// following properties:
246
246
//
247
- // obj.href: http://jblas:
[email protected] :8080/mail/inbox?msg=1234&type=unread#msg-content
248
- // obj.hrefNoHash: http://jblas:
[email protected] :8080/mail/inbox?msg=1234&type=unread
247
+ // obj.href: http://jblas:
[email protected] :8080/mail/inbox?msg=1234&
amp; type=unread#msg-content
248
+ // obj.hrefNoHash: http://jblas:
[email protected] :8080/mail/inbox?msg=1234&
amp; type=unread
249
249
// obj.hrefNoSearch: http://jblas:
[email protected] :8080/mail/inbox
250
250
// obj.domain: http://jblas:
[email protected] :8080
251
251
// obj.protocol: http:
@@ -258,7 +258,7 @@ <h1>Methods</h1>
258
258
// obj.pathname: /mail/inbox
259
259
// obj.directory: /mail/
260
260
// obj.filename: inbox
261
- // obj.search: ?msg=1234&type=unread
261
+ // obj.search: ?msg=1234& type=unread
262
262
// obj.hash: #msg-content</ strong >
263
263
264
264
var obj = $.mobile.path.parseUrl("http://jblas:
[email protected] :8080/mail/inbox?msg=1234");
@@ -268,6 +268,188 @@ <h1>Methods</h1>
268
268
</ dd >
269
269
270
270
271
+ < dt > < code > $.mobile.path.makePathAbsolute</ code > (< em > method</ em > )</ dt >
272
+ < dd > Utility method for converting a relative file or directory path into an absolute path.</ dd >
273
+ < dd >
274
+ < dl >
275
+ < dt > Arguments</ dt >
276
+ < dd > < code > relPath</ code > (< em > string</ em > , required) A relative file or directory path.</ dd >
277
+ < dd > < code > absPath</ code > (< em > string</ em > , required) An absolute file or relative path to resolve against.</ dd >
278
+
279
+ < dt > Return Value</ dt >
280
+ < dd > This function returns a string that is an absolute version of the relative path passed in.</ dd >
281
+
282
+ </ dl >
283
+ </ dd >
284
+ < dd > Examples:
285
+ < pre >
286
+ < code >
287
+ < strong > // Returns: /a/b/c/file.html</ strong >
288
+ var absPath = $.mobile.path.makePathAbsolute("file.html", "/a/b/c/bar.html");
289
+
290
+ < strong > // Returns: /a/foo/file.html</ strong >
291
+ var absPath = $.mobile.path.makePathAbsolute("../../foo/file.html", "/a/b/c/bar.html");
292
+
293
+ </ code >
294
+ </ pre >
295
+ </ dd >
296
+
297
+
298
+ < dt > < code > $.mobile.path.makeUrlAbsolute</ code > (< em > method</ em > )</ dt >
299
+ < dd > Utility method for converting a relative URL to an absolute URL.</ dd >
300
+ < dd >
301
+
302
+ < dl >
303
+ < dt > Arguments</ dt >
304
+ < dd > < code > relUrl</ code > (< em > string</ em > , required) A relative URL.</ dd >
305
+ < dd > < code > absUrl</ code > (< em > string</ em > , required) An absolute URL to resolve against.</ dd >
306
+
307
+ < dt > Return Value</ dt >
308
+ < dd > This function returns a string that is an absolute version of the relative URL passed in.</ dd >
309
+
310
+ </ dl >
311
+ </ dd >
312
+ < dd > Examples:
313
+ < pre >
314
+ < code >
315
+ < strong > // Returns: http://foo.com/a/b/c/file.html</ strong >
316
+ var absUrl = $.mobile.path.makeUrlAbsolute("file.html", "http://foo.com/a/b/c/test.html");
317
+
318
+ < strong > // Returns: http://foo.com/a/foo/file.html</ strong >
319
+ var absUrl = $.mobile.path.makeUrlAbsolute("../../foo/file.html", "http://foo.com/a/b/c/test.html");
320
+
321
+ < strong > // Returns: http://foo.com/bar/file.html</ strong >
322
+ var absUrl = $.mobile.path.makeUrlAbsolute("//foo.com/bar/file.html", "http://foo.com/a/b/c/test.html");
323
+
324
+ < strong > // Returns: http://foo.com/a/b/c/test.html?a=1&b=2</ strong >
325
+ var absUrl = $.mobile.path.makeUrlAbsolute("?a=1&b=2", "http://foo.com/a/b/c/test.html");
326
+
327
+ < strong > // Returns: http://foo.com/a/b/c/test.html#bar</ strong >
328
+ var absUrl = $.mobile.path.makeUrlAbsolute("#bar", "http://foo.com/a/b/c/test.html");
329
+
330
+ </ code >
331
+ </ pre >
332
+
333
+ </ dd >
334
+
335
+
336
+ < dt > < code > $.mobile.path.isSameDomain</ code > (< em > method</ em > )</ dt >
337
+ < dd > Utility method for comparing the domain of 2 URLs.</ dd >
338
+ < dd >
339
+
340
+ < dl >
341
+ < dt > Arguments</ dt >
342
+ < dd > < code > url1</ code > (< em > string</ em > , required) A relative URL.</ dd >
343
+ < dd > < code > url2</ code > (< em > string</ em > , required) An absolute URL to resolve against.</ dd >
344
+
345
+ < dt > Return Value</ dt >
346
+ < dd > This function returns a boolean true if the domains match, false if they don't.</ dd >
347
+
348
+ </ dl >
349
+ </ dd >
350
+ < dd > Examples:
351
+ < pre >
352
+ < code >
353
+ < strong > // Returns: true</ strong >
354
+ var same = $.mobile.path.isSameDomain("http://foo.com/a/file.html", "http://foo.com/a/b/c/test.html");
355
+
356
+ < strong > // Returns: false</ strong >
357
+ var same = $.mobile.path.isSameDomain("file://foo.com/a/file.html", "http://foo.com/a/b/c/test.html");
358
+
359
+ < strong > // Returns: false</ strong >
360
+ var same = $.mobile.path.isSameDomain("https://foo.com/a/file.html", "http://foo.com/a/b/c/test.html");
361
+
362
+ < strong > // Returns: false</ strong >
363
+ var same = $.mobile.path.isSameDomain("http://foo.com/a/file.html", "http://bar.com/a/b/c/test.html");
364
+
365
+ </ code >
366
+ </ pre >
367
+
368
+ </ dd >
369
+
370
+
371
+ < dt > < code > $.mobile.path.isRelativeUrl</ code > (< em > method</ em > )</ dt >
372
+ < dd > Utility method for determining if a URL is a relative variant.</ dd >
373
+ < dd >
374
+
375
+ < dl >
376
+ < dt > Arguments</ dt >
377
+ < dd > < code > url</ code > (< em > string</ em > , required) A relative or absolute URL.</ dd >
378
+
379
+ < dt > Return Value</ dt >
380
+ < dd > This function returns a boolean true if the URL is relative, false if it is absolute.</ dd >
381
+
382
+ </ dl >
383
+ </ dd >
384
+ < dd > Examples:
385
+ < pre >
386
+ < code >
387
+ < strong > // Returns: false</ strong >
388
+ var isRel = $.mobile.path.isRelativeUrl("http://foo.com/a/file.html");
389
+
390
+ < strong > // Returns: true</ strong >
391
+ var isRel = $.mobile.path.isRelativeUrl("//foo.com/a/file.html");
392
+
393
+ < strong > // Returns: true</ strong >
394
+ var isRel = $.mobile.path.isRelativeUrl("/a/file.html");
395
+
396
+ < strong > // Returns: true</ strong >
397
+ var isRel = $.mobile.path.isRelativeUrl("file.html");
398
+
399
+ < strong > // Returns: true</ strong >
400
+ var isRel = $.mobile.path.isRelativeUrl("?a=1&b=2");
401
+
402
+ < strong > // Returns: true</ strong >
403
+ var isRel = $.mobile.path.isRelativeUrl("#foo");
404
+
405
+
406
+ </ code >
407
+ </ pre >
408
+
409
+ </ dd >
410
+
411
+
412
+ < dt > < code > $.mobile.path.isAbsoluteUrl</ code > (< em > method</ em > )</ dt >
413
+ < dd > Utility method for determining if a URL is absolute.</ dd >
414
+ < dd >
415
+
416
+ < dl >
417
+ < dt > Arguments</ dt >
418
+ < dd > < code > url</ code > (< em > string</ em > , required) A relative or absolute URL.</ dd >
419
+
420
+ < dt > Return Value</ dt >
421
+ < dd > This function returns a boolean true if the URL is absolute, false if it is absolute.</ dd >
422
+
423
+ </ dl >
424
+ </ dd >
425
+ < dd > Examples:
426
+ < pre >
427
+ < code >
428
+ < strong > // Returns: true</ strong >
429
+ var isAbs = $.mobile.path.isAbsoluteUrl("http://foo.com/a/file.html");
430
+
431
+ < strong > // Returns: false</ strong >
432
+ var isAbs = $.mobile.path.isAbsoluteUrl("//foo.com/a/file.html");
433
+
434
+ < strong > // Returns: false</ strong >
435
+ var isAbs = $.mobile.path.isAbsoluteUrl("/a/file.html");
436
+
437
+ < strong > // Returns: false</ strong >
438
+ var isAbs = $.mobile.path.isAbsoluteUrl("file.html");
439
+
440
+ < strong > // Returns: false</ strong >
441
+ var isAbs = $.mobile.path.isAbsoluteUrl("?a=1&b=2");
442
+
443
+ < strong > // Returns: false</ strong >
444
+ var isAbs = $.mobile.path.isAbsoluteUrl("#foo");
445
+
446
+
447
+ </ code >
448
+ </ pre >
449
+
450
+ </ dd >
451
+
452
+
271
453
< dt > < code > $.mobile.base</ code > (< em > methods, properties</ em > )</ dt >
272
454
< dd > Utilities for working with generated base element. TODO: document as public API is finalized.</ dd >
273
455
0 commit comments