@@ -1963,14 +1963,7 @@ Autolinker.matchParser.MatchParser = Autolinker.Util.extend( Object, {
1963
1963
if ( this . matchHasUnbalancedClosingParen ( matchStr ) ) {
1964
1964
matchStr = matchStr . substr ( 0 , matchStr . length - 1 ) ; // remove the trailing ")"
1965
1965
suffixStr = ")" ; // this will be added after the generated <a> tag
1966
- } else {
1967
- // Handle an invalid character after the TLD
1968
- var pos = this . matchHasInvalidCharAfterTld ( urlMatch , protocolUrlMatch ) ;
1969
- if ( pos > - 1 ) {
1970
- suffixStr = matchStr . substr ( pos ) ; // this will be added after the generated <a> tag
1971
- matchStr = matchStr . substr ( 0 , pos ) ; // remove the trailing invalid chars
1972
- }
1973
- }
1966
+ }
1974
1967
1975
1968
if ( emailAddressMatch ) {
1976
1969
match = new Autolinker . match . Email ( { matchedText : matchStr , email : emailAddressMatch } ) ;
@@ -2065,52 +2058,9 @@ Autolinker.matchParser.MatchParser = Autolinker.Util.extend( Object, {
2065
2058
}
2066
2059
2067
2060
return false ;
2068
- } ,
2069
-
2070
-
2071
- /**
2072
- * Determine if there's an invalid character after the TLD in a URL. Valid
2073
- * characters after TLD are ':/?#'. Exclude protocol matched URLs from this
2074
- * check.
2075
- *
2076
- * @private
2077
- * @param {String } urlMatch The matched URL, if there was one. Will be an
2078
- * empty string if the match is not a URL match.
2079
- * @param {String } protocolUrlMatch The match URL string for a protocol
2080
- * match. Ex: 'http://yahoo.com'. This is used to match something like
2081
- * 'http://localhost', where we won't double check that the domain name
2082
- * has at least one '.' in it.
2083
- * @return {Number } the position where the invalid character was found. If
2084
- * no such character was found, returns -1
2085
- */
2086
- matchHasInvalidCharAfterTld : function ( urlMatch , protocolUrlMatch ) {
2087
- if ( ! urlMatch ) {
2088
- return - 1 ;
2089
- }
2090
-
2091
- var offset = 0 ;
2092
- if ( protocolUrlMatch ) {
2093
- offset = urlMatch . indexOf ( ':' ) ;
2094
- urlMatch = urlMatch . slice ( offset ) ;
2095
- }
2096
-
2097
- var re = / ^ ( ( .? \/ \/ ) ? [ A - Z a - z 0 - 9 \. \- ] * [ A - Z a - z 0 - 9 \- ] \. [ A - Z a - z ] + ) / ;
2098
- var res = re . exec ( urlMatch ) ;
2099
- if ( res === null ) {
2100
- return - 1 ;
2101
- }
2102
-
2103
- offset += res [ 1 ] . length ;
2104
- urlMatch = urlMatch . slice ( res [ 1 ] . length ) ;
2105
- if ( / ^ [ ^ . A - Z a - z : \/ ? # ] / . test ( urlMatch ) ) {
2106
- return offset ;
2107
- }
2108
-
2109
- return - 1 ;
2110
- }
2061
+ }
2111
2062
2112
2063
} ) ;
2113
-
2114
2064
/*global Autolinker */
2115
2065
/*jshint scripturl:true */
2116
2066
/**
0 commit comments