Skip to content

Commit

Permalink
Remove extra attributes form the URL autolinks: twitter-archive#7
Browse files Browse the repository at this point in the history
  • Loading branch information
mzsanford committed Jul 25, 2011
1 parent 199a10a commit c3b5f1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/tests.js
Expand Up @@ -39,6 +39,7 @@ test("twttr.txt.autolink", function() {
ok(twttr.txt.autoLink("@tw", { at: "!" }).match(/!<a[^>]+>tw<\/a>/), "Override at");
ok(twttr.txt.autoLink("@tw", { preChunk: "<b>" }).match(/@<a[^>]+><b>tw<\/a>/), "Override preChunk");
ok(twttr.txt.autoLink("@tw", { postChunk: "</b>" }).match(/@<a[^>]+>tw<\/b><\/a>/), "Override postChunk");
ok(!twttr.txt.autoLink("foo http://example.com", { usernameClass: 'custom-user' }).match(/custom-user/), "Override usernameClass should not be applied to URL");

// Hashtag Overrides
ok(twttr.txt.autoLink("#hi", { before: "!" }).match(/!<a[^>]+>#hi<\/a>/), "Override before");
Expand Down
4 changes: 4 additions & 0 deletions twitter-text.js
Expand Up @@ -405,6 +405,10 @@ if (!window.twttr) {

delete options.suppressNoFollow;
delete options.suppressDataScreenName;
delete options.listClass;
delete options.usernameClass;
delete options.usernameUrlBase;
delete options.listUrlBase;

return text.replace(twttr.txt.regexen.extractUrl, function(match, all, before, url, protocol, domain, path, queryString) {
var tldComponents;
Expand Down

0 comments on commit c3b5f1e

Please sign in to comment.