Fix starts-with() for JRuby 1.7
''.start_with?('') returns false on JRuby 1.7. While I'd love to drop support for shit like this, JRuby 1.7 is still in common use today, so lets just work around this for now.
This commit is contained in:
parent
bf0ca7c907
commit
67ada1168e
|
@ -1032,10 +1032,16 @@ module Oga
|
||||||
needle_var.assign(try_match_first_node(needle, input))
|
needle_var.assign(try_match_first_node(needle, input))
|
||||||
end
|
end
|
||||||
.followed_by do
|
.followed_by do
|
||||||
converted = conversion.to_string(haystack_var)
|
haystack_var.assign(conversion.to_string(haystack_var))
|
||||||
.start_with?(conversion.to_string(needle_var))
|
.followed_by do
|
||||||
|
needle_var.assign(conversion.to_string(needle_var))
|
||||||
|
end
|
||||||
|
.followed_by do
|
||||||
|
equal = needle_var.empty?
|
||||||
|
.or(haystack_var.start_with?(needle_var))
|
||||||
|
|
||||||
block_given? ? converted.if_true { yield } : converted
|
block_given? ? equal.if_true { yield } : equal
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue