Skip to content
This repository has been archived by the owner on Jun 6, 2019. It is now read-only.

Commit

Permalink
Add URL toString() method to return synonym for href. (according to s…
Browse files Browse the repository at this point in the history
…pec)

Current build:

    var u = new URL('b', 'http://a');
    console.log( u.toString() ); // "[object Object]""

After patch:

    var u = new URL('b', 'http://a');
    console.log( u.toString() ); // "http://a/b"

// currently I cannot find URL related test on tests folder, should I write some tests for this patch?
  • Loading branch information
threeday0905 authored and dfreedm committed May 23, 2015
1 parent 97529b5 commit 79d0190
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions url.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,9 @@
}

jURL.prototype = {
toString: function() {
return this.href;
},
get href() {
if (this._isInvalid)
return this._url;
Expand Down

0 comments on commit 79d0190

Please sign in to comment.