We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If we have in file.twig code like this:
{% set myVar = '1' %} {% set myArray = [1, 2] %} {% if myVar in myArray %} 1 {% else %} 2 {% endif %}
then result is '1' with php but '2' with js. It's so, because the way how twig.contains works:
twig.contains
$goog$exportSymbol$$("twig.contains", function($haystack$$, $needle$$) { var $JSCompiler_temp$$159_JSCompiler_temp$$160_key$$inline_169$$; if($goog$isArray$$($haystack$$)) { // incorrect way, strict eq (through indexOf) $JSCompiler_temp$$159_JSCompiler_temp$$160_key$$inline_169$$ = 0 <= $goog$array$indexOf$$($haystack$$, $needle$$) }else { if($goog$isString$$($haystack$$)) { $JSCompiler_temp$$159_JSCompiler_temp$$160_key$$inline_169$$ = -1 != $haystack$$.indexOf($needle$$) && ("" !== $needle$$ || "" === $haystack$$) }else { a: { for($JSCompiler_temp$$159_JSCompiler_temp$$160_key$$inline_169$$ in $haystack$$) { // correct way, non-strict eq '==' if($haystack$$[$JSCompiler_temp$$159_JSCompiler_temp$$160_key$$inline_169$$] == $needle$$) { $JSCompiler_temp$$159_JSCompiler_temp$$160_key$$inline_169$$ = $JSCompiler_alias_TRUE$$; break a } } $JSCompiler_temp$$159_JSCompiler_temp$$160_key$$inline_169$$ = $JSCompiler_alias_FALSE$$ } } } return $JSCompiler_temp$$159_JSCompiler_temp$$160_key$$inline_169$$ });
The text was updated successfully, but these errors were encountered:
Add failing test reproducing the bug reported in issue #86
49f6134
No branches or pull requests
If we have in file.twig code like this:
then result is '1' with php
but '2' with js.
It's so, because the way how
twig.contains
works:The text was updated successfully, but these errors were encountered: