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:
1 parent
bcbdf5e4e7
commit
338aeeb514
1 file changed
+2
-1
@@ -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
|
||||
|
||||
##
|
||||
|
||||
Reference in new issue
Block a user