Fix cross-iframe issue with length filter

The length filter's instanceof checks produce erroneous output when handling data originating from another iframe. This commit fixes the issue by replacing those instanceof checks with usage of Twig.lib.is.