JavaScript: Improved condition for outlining (#526)

Fixes #526.