Skip to content

Commit

Permalink
Reduce allocations from hack in document_fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmaroli committed Sep 28, 2020
1 parent 793baae commit 6f81566
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/nokogiri/html/document_fragment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def initialize document, tags = nil, ctx = nil
self.errors = document.errors - preexisting_errors
else
# This is a horrible hack, but I don't care
if tags.strip =~ /^<body/i
if /^\s*?<body/i.match?(tags)
path = "/html/body"
else
path = "/html/body/node()"
Expand Down

0 comments on commit 6f81566

Please sign in to comment.