Skip to content

Commit

Permalink
Fixing SLD detection - foot.se would detect t.se - Issue #42
Browse files Browse the repository at this point in the history
  • Loading branch information
rodneyrehm committed Aug 26, 2012
1 parent afb8d2f commit bff0696
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/SecondLevelDomains.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ var SLD = {
t += '|(' + expression + ')';
}

SLD.has_expression = new RegExp('\.(' + t.substr(1) + ')$', 'i');
SLD.has_expression = new RegExp('\\.(' + t.substr(1) + ')$', 'i');
SLD.is_expression = new RegExp('^(' + t.substr(1) + ')$', 'i');
}
};
Expand Down
4 changes: 4 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ test("tld", function() {
u.tld('org');
equal(u.tld(), "org", "sld changed to tld");
equal(u+"", "http://www.example.org/foo.html", "changed url to tld");

u.hostname('www.examplet.se');
equal(u.tld(), "se", "se tld");

});
test("directory", function() {
var u = new URI("http://www.example.org/some/directory/foo.html");
Expand Down

0 comments on commit bff0696

Please sign in to comment.