Work around JRuby issue #1923.
String#start_with?() returns false on JRuby when used with an empty string. See https://github.com/jruby/jruby/issues/1923 for more information.
This commit is contained in:
parent
bcbdf5e4e7
commit
338aeeb514
|
@ -855,7 +855,8 @@ module Oga
|
|||
haystack_str = on_call_string(context, haystack)
|
||||
needle_str = on_call_string(context, needle)
|
||||
|
||||
return haystack_str.start_with?(needle_str)
|
||||
# https://github.com/jruby/jruby/issues/1923
|
||||
return needle_str.empty? || haystack_str.start_with?(needle_str)
|
||||
end
|
||||
|
||||
##
|
||||
|
|
Loading…
Reference in New Issue