Commit 86d1052 1 parent efae1e5 commit 86d1052 Copy full SHA for 86d1052
File tree 2 files changed +53
-0
lines changed
2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 239
239
// balanced parens inclusion (), [], {}, <>
240
240
parens : / ( \( [ ^ \) ] * \) | \[ [ ^ \] ] * \] | \{ [ ^ } ] * \} | < [ ^ > ] * > ) / g,
241
241
} ;
242
+ URI . leading_whitespace_expression = / ^ [ \x00 - \x20 \u00a0 \u1680 \u2000 - \u200a \u2028 \u2029 \u202f \u205f \u3000 \ufeff ] + /
242
243
// http://www.iana.org/assignments/uri-schemes.html
243
244
// http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers#Well-known_ports
244
245
URI . defaultPorts = {
494
495
preventInvalidHostname : URI . preventInvalidHostname
495
496
} ;
496
497
}
498
+
499
+ string = string . replace ( URI . leading_whitespace_expression , '' )
500
+
497
501
// [protocol"://"[username[":"password]"@"]hostname[":"port]"/"?][path]["?"querystring]["#"fragment]
498
502
499
503
// extract fragment
Original file line number Diff line number Diff line change @@ -2571,6 +2571,55 @@ var urls = [{
2571
2571
idn : false ,
2572
2572
punycode : false
2573
2573
}
2574
+ } , {
2575
+ name : 'leading white space' ,
2576
+ url : '\t\bhttp://www.example.org/?hello=world' ,
2577
+ _url : 'http://www.example.org/?hello=world' ,
2578
+ parts : {
2579
+ protocol : 'http' ,
2580
+ username : null ,
2581
+ password : null ,
2582
+ hostname : 'www.example.org' ,
2583
+ port : null ,
2584
+ path : '/' ,
2585
+ query : 'hello=world' ,
2586
+ fragment : null
2587
+ } ,
2588
+ accessors : {
2589
+ protocol : 'http' ,
2590
+ username : '' ,
2591
+ password : '' ,
2592
+ port : '' ,
2593
+ path : '/' ,
2594
+ query : 'hello=world' ,
2595
+ fragment : '' ,
2596
+ resource : '/?hello=world' ,
2597
+ authority : 'www.example.org' ,
2598
+ origin : 'http://www.example.org' ,
2599
+ userinfo : '' ,
2600
+ subdomain : 'www' ,
2601
+ domain : 'example.org' ,
2602
+ tld : 'org' ,
2603
+ directory : '/' ,
2604
+ filename : '' ,
2605
+ suffix : '' ,
2606
+ hash : '' ,
2607
+ search : '?hello=world' ,
2608
+ host : 'www.example.org' ,
2609
+ hostname : 'www.example.org'
2610
+ } ,
2611
+ is : {
2612
+ urn : false ,
2613
+ url : true ,
2614
+ relative : false ,
2615
+ name : true ,
2616
+ sld : false ,
2617
+ ip : false ,
2618
+ ip4 : false ,
2619
+ ip6 : false ,
2620
+ idn : false ,
2621
+ punycode : false
2622
+ }
2574
2623
}
2575
2624
] ;
2576
2625
You can’t perform that action at this time.
0 commit comments