Skip to content

Navigation: Add documentation for $.mobile.path.makePathAbsolute #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions entries/jQuery.mobile.path.makePathAbsolute.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0"?>
<entry type="method" name="jQuery.mobile.path.makePathAbsolute" return="Boolean">
<title>jQuery.mobile.path.makePathAbsolute()</title>
<desc>Utility method for converting a relative file or directory path into an absolute path.</desc>
<signature>
<argument name="relPath">
<type name="String">
<desc>A relative file or directory path.</desc>
</type>
</argument>
<argument name="absPath">
<type name="String">
<desc>An absolute file or directory path against which to resolve.</desc>
</type>
</argument>
</signature>
<example>
<desc>Various uses of jQuery.mobile.path.makePathAbsolute</desc>
<css><![CDATA[
#myResult{
border: 1px solid;
border-color: #108040;
padding: 10px;
}
]]></css>
<html><![CDATA[
<div role="main" class="ui-content">
<input type="button" value="file.html relative to /a/b/c/bar.html" class="myButton" data-inline="true">
<input type="button" value="../../file.html relative to /a/b/c/bar.html" class="myButton" data-inline="true">
<div id="myResult">The result will be displayed here</div>
</div>]]></html>
<code><![CDATA[
$(document).ready(function() {

$( ".myButton" ).on( "click", function() {

var arguments = $( this ).attr( "value" ).split( " relative to " ),
absolutePath = $.mobile.path.makePathAbsolute( arguments[ 0 ], arguments[ 1 ] );

$( "#myResult" ).text( absolutePath );
})
});
]]></code>
</example>
<longdesc>
<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>
</longdesc>
<category slug="methods/path"/>
</entry>