Skip to content

Commit

Permalink
fixing path() to return empty string when necessary - closes #82
Browse files Browse the repository at this point in the history
  • Loading branch information
rodneyrehm committed Aug 3, 2013
1 parent be87bf4 commit 7172bec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ URI.js is published under the [MIT license](http://www.opensource.org/licenses/m

### `[dev-version]` (master branch) ###

* fixing [`path()`](http://medialize.github.io/URI.js/docs.html#accessors-pathname) to return empty string if there is no path - ([Issue #97](https://github.com/medialize/URI.js/issues/97))
* fixing crashing of `URI.decodeQuery()` on malformed input - now returns original undecoded data - ([Issue #87](https://github.com/medialize/URI.js/issues/87), [Issue #92](https://github.com/medialize/URI.js/issues/92))
* fixing build tool - ([Issue #83](https://github.com/medialize/URI.js/issues/83))
* fixing for-loop to make closure compiler happy - ([Issue #93](https://github.com/medialize/URI.js/issues/93))
Expand Down
8 changes: 7 additions & 1 deletion docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,13 @@ <h3 id="accessors-pathname">pathname(), path()</h3>
uri.pathname("/hello world/");
uri.pathname() === "/hello%20world/";
// will decode for you
uri.pathname(true) === "/hello world/";</pre>
uri.pathname(true) === "/hello world/";

// will return empty string for empty paths, but:
URI("").path() === "";
URI("/").path() === "/";
URI("http://example.org").path() === "/";
</pre>

<h3 id="accessors-directory">directory()</h3>
<p>.directory() is an convenience method for mutating the directory part of a path</p>
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test("new URI(Location)", function () {
var u = new URI(element);
equal(u.scheme(), "", "scheme");
equal(u.host(), "", "host");
equal(u.path(), "/", "path");
equal(u.path(), "", "path");

element[attribute] = "file:///C:/foo/bar.html";
u = new URI(element);
Expand Down

0 comments on commit 7172bec

Please sign in to comment.