File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -272,14 +272,10 @@ pub fn getHost(raw: [:0]const u8) []const u8 {
272272
273273// Returns true if these two URLs point to the same document.
274274pub fn eqlDocument (first : [:0 ]const u8 , second : [:0 ]const u8 ) bool {
275- if (! std .mem .eql (u8 , getProtocol (first ), getProtocol (second ))) return false ;
276- if (! std .mem .eql (u8 , getHost (first ), getHost (second ))) return false ;
277- if (! std .mem .eql (u8 , getPort (first ), getPort (second ))) return false ;
278- if (! std .mem .eql (u8 , getPathname (first ), getPathname (second ))) return false ;
279- if (! std .mem .eql (u8 , getSearch (first ), getSearch (second ))) return false ;
280- // hashes are allowed to be different.
281-
282- return true ;
275+ // First '#' signifies the start of the fragment.
276+ const first_hash_index = std .mem .indexOfScalar (u8 , first , '#' ) orelse first .len ;
277+ const second_hash_index = std .mem .indexOfScalar (u8 , second , '#' ) orelse second .len ;
278+ return std .mem .eql (u8 , first [0.. first_hash_index ], second [0.. second_hash_index ]);
283279}
284280
285281const KnownProtocol = enum {
You can’t perform that action at this time.
0 commit comments