Skip to content

Commit edc1e33

Browse files
author
Gabriel Schulhof
committed
Navigation: Add documentation for $.mobile.path.makePathAbsolute
Closes gh-257 Fixes gh-248
1 parent 0ec52d5 commit edc1e33

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0"?>
2+
<entry type="method" name="jQuery.mobile.path.makePathAbsolute" return="Boolean">
3+
<title>jQuery.mobile.path.makePathAbsolute()</title>
4+
<desc>Utility method for converting a relative file or directory path into an absolute path.</desc>
5+
<signature>
6+
<argument name="relPath">
7+
<type name="String">
8+
<desc>A relative file or directory path.</desc>
9+
</type>
10+
</argument>
11+
<argument name="absPath">
12+
<type name="String">
13+
<desc>An absolute file or directory path against which to resolve.</desc>
14+
</type>
15+
</argument>
16+
</signature>
17+
<example>
18+
<desc>Various uses of jQuery.mobile.path.makePathAbsolute</desc>
19+
<css><![CDATA[
20+
#myResult{
21+
border: 1px solid;
22+
border-color: #108040;
23+
padding: 10px;
24+
}
25+
]]></css>
26+
<html><![CDATA[
27+
<div role="main" class="ui-content">
28+
<input type="button" value="file.html relative to /a/b/c/bar.html" class="myButton" data-inline="true">
29+
<input type="button" value="../../file.html relative to /a/b/c/bar.html" class="myButton" data-inline="true">
30+
<div id="myResult">The result will be displayed here</div>
31+
</div>]]></html>
32+
<code><![CDATA[
33+
$(document).ready(function() {
34+
35+
$( ".myButton" ).on( "click", function() {
36+
37+
var arguments = $( this ).attr( "value" ).split( " relative to " ),
38+
absolutePath = $.mobile.path.makePathAbsolute( arguments[ 0 ], arguments[ 1 ] );
39+
40+
$( "#myResult" ).text( absolutePath );
41+
})
42+
});
43+
]]></code>
44+
</example>
45+
<longdesc>
46+
<p>Given a path that is relative to another absolute path, this utility will convert the relative path to an absolute path based on the given absolute path.</p>
47+
</longdesc>
48+
<category slug="methods/path"/>
49+
</entry>

0 commit comments

Comments
 (0)