Skip to content

Commit c0ccc7e

Browse files
author
Mark Perkins
committed
Minor tweaks to the docs.
1 parent 3f1d1a5 commit c0ccc7e

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

README.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
jQuery URL Parser v2.0
22
======================
33

4-
A jQuery plugin to parse urls and provide easy access to their attributes (such as the protocol, host, port etc), path segments, query string paramters, fragment parameters and more.
4+
A jQuery plugin to parse urls and provide easy access to their attributes (such as the protocol, host, port etc), path segments, querystring parameters, fragment parameters and more.
55

66
The core parser functionality is based on the [Regex URI parser by Steven Levithan](http://blog.stevenlevithan.com/archives/parseuri).
77

88
*Please note that version 2 is not backwards compatible with version 1 of this plugin. v1 is tagged and still available should you need it for some reason.*
99

1010
This plugin requires jQuery to work. Tested on 1.4 and above but will probably work on older versions, too.
1111

12-
License
13-
-------
14-
15-
http://unlicense.org/ - i.e. do what you want with it :-)
16-
12+
**License:** http://unlicense.org/ - i.e. do what you want with it :-)
1713

1814
Specifying the URL to parse
1915
---------------------------
@@ -22,9 +18,7 @@ There are a few different ways to choose what URL to parse:
2218

2319
``` javascript
2420
var url = $.url(); // parse the current page URL
25-
2621
var url = $.url('http://allmarkedup.com'); // pass in a URI as a string and parse that
27-
2822
var url = $('#myElement').url(); // extract the URL from the selected element and parse that - will work on any element with a `src`, `href` or `action` attribute.
2923
```
3024

@@ -45,11 +39,11 @@ The attributes available for querying are:
4539
* **protocol** - eg. http, https, file, etc
4640
* **host** - eg. www.mydomain.com, localhost etc
4741
* **port** - eg. 80
48-
* **relative** - the relative path to the file including the query string (eg. /folder/dir/index.html?item=value)
42+
* **relative** - the relative path to the file including the querystring (eg. /folder/dir/index.html?item=value)
4943
* **path** - the path to the file (eg. /folder/dir/index.html)
5044
* **directory** - the directory part of the path (eg. /folder/dir/)
5145
* **file** - the basename of the file eg. index.html
52-
* **query** - the entire query string if it exists, eg. item=value&item2=value2
46+
* **query** - the entire querystring if it exists, eg. item=value&item2=value2
5347
* **fragment** (also available as **anchor**) - the entire string after the # symbol
5448

5549
There are also a few more obscure ones available too if you want to dig about a bit ;-)
@@ -59,20 +53,22 @@ If you don't specify an attribute then this method will return an object literal
5953
Query string parameters
6054
-----------------------
6155

62-
The `.param()` method is used to return the values of query string parameters.
56+
The `.param()` method is used to return the values of querystring parameters.
6357

6458
Pass in a string to access that parameter's value:
6559

6660
``` javascript
6761
$.url('http://allmarkedup.com?sky=blue&grass=green').param('sky'); // returns 'blue'
6862
```
6963

70-
If no argument is passed in it will return an object literal containing a key:value map of all the query string parameters.
64+
If no argument is passed in it will return an object literal containing a key:value map of all the querystring parameters.
7165

7266
``` javascript
7367
$.url('http://allmarkedup.com?sky=blue&grass=green').param(); // returns { 'sky':'blue', 'grass':'green' }
7468
```
7569

70+
Note that the `.param()` method will work on both ampersand-split and semicolon-split querystrings.
71+
7672
URL segments
7773
-----------------------
7874

@@ -93,10 +89,10 @@ If no argument is passed in it will return an array of all the segments (which w
9389
$.url('http://allmarkedup.com/folder/dir/example/index.html').segment(); // returns ['folder','dir','example','index.html']
9490
```
9591

96-
Fragment parameters or segments
92+
Fragment parameters and/or segments
9793
-------------------------------
9894

99-
Some sites and apps also use the hash fragment to store query string-style key value pairs (eg. `http://test.com/#sky=blue&grass=green`), or slash-delimited paths (eg. `http://test.com/#/about/us/`).
95+
Some sites and apps also use the hash fragment to store querystring-style key value pairs (eg. `http://test.com/#sky=blue&grass=green`), or slash-delimited paths (eg. `http://test.com/#/about/us/`).
10096

10197
There are two methods available for extracting information from fragments of these types - `.fparam()` and `.fsegment()`, both of which behave indentically to their `.param()` and `.segment()` counterparts but act on the fragment rather than the main URL.
10298

0 commit comments

Comments
 (0)