Skip to content

Commit 33de411

Browse files
author
Gabriel Schulhof
committed
Navigation: Add documentation for $.mobile.path.isSameDomain
Fixes gh-249
1 parent 8d8ed2a commit 33de411

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0"?>
2+
<entry type="method" name="jQuery.mobile.path.isSameDomain" return="Boolean">
3+
<title>jQuery.mobile.path.isSameDomain()</title>
4+
<desc>Utility method for determining if a URL has the same domain.</desc>
5+
<signature>
6+
<argument name="absUrl1">
7+
<type name="String">
8+
<desc>An absolute URL.</desc>
9+
</type>
10+
</argument>
11+
<argument name="absUrl2">
12+
<type name="String">
13+
<desc>Another absolute URL.</desc>
14+
</type>
15+
</argument>
16+
</signature>
17+
<example>
18+
<desc>Various uses of jQuery.mobile.path.isSameDomain</desc>
19+
<height>350px</height>
20+
<css><![CDATA[
21+
.versus {
22+
display: inline-block;
23+
}
24+
.compare {
25+
margin-bottom: 2.3em;
26+
}
27+
#myResult{
28+
border: 1px solid;
29+
border-color: #108040;
30+
padding: 10px;
31+
}
32+
]]></css>
33+
<html><![CDATA[
34+
<div role="main" class="ui-content ui-mini">
35+
<div>
36+
<a href="javascript:void(0)" class="ui-btn ui-corner-all ui-btn-inline ui-shadow compare">Same Domain?</a>
37+
<div class="versus">
38+
<pre><code>http://example.com/</code></pre>
39+
<pre><code>http://slashdot.org/</code></pre>
40+
</div>
41+
</div>
42+
<div>
43+
<a href="javascript:void(0)" class="ui-btn ui-corner-all ui-btn-inline ui-shadow compare">Same Domain?</a>
44+
<div class="versus">
45+
<pre><code>http://edition.cnn.com/</code></pre>
46+
<pre><code>http://cnn.com/</code></pre>
47+
</div>
48+
</div>
49+
<div>
50+
<a href="javascript:void(0)" class="ui-btn ui-corner-all ui-btn-inline ui-shadow compare">Same Domain?</a>
51+
<div class="versus">
52+
<pre><code>http://www.amazon.co.uk/</code></pre>
53+
<pre><code>http://www.amazon.co.uk/</code></pre>
54+
</div>
55+
</div>
56+
<div id="myResult"></div>
57+
</div>
58+
]]></html>
59+
<code><![CDATA[
60+
$(document).ready(function() {
61+
$( ".compare" ).on( "click", function() {
62+
63+
var urlContainers = $( this ).siblings( ".versus" ).find( "code" ),
64+
url1 = urlContainers.first().text(),
65+
url2 = urlContainers.last().text();
66+
67+
$( "#myResult" ).text( String( $.mobile.path.isSameDomain( url1, url2 ) ) );
68+
})
69+
});
70+
]]></code>
71+
</example>
72+
<longdesc>
73+
<p>Utility method for determining if a URL is absolute. This function returns a boolean true if the URL is absolute, false if not.</p>
74+
</longdesc>
75+
<category slug="methods/path"/>
76+
</entry>

0 commit comments

Comments
 (0)