Skip Navigation

Views cannot parse third-party shortcodes that contain JavaScript and a JS error is being triggered

Won't fix

Reported for: Toolset Views 2.7.5

Symptoms

Generally, Toolset does not have issues with parsing third-party shortcodes inside its content.

However, there is an issue with parsing shortcodes coming from third-party plugins that output JavaScript code within their content.

For example, the Leaflet plugin outputs HTML code to generate a map and JavaScript code to initialize the map and the markers inside this map.

In such cases, Views will not be able to parse this data and a JavaScript error will be triggered.

For example, you might see the following console error: Uncaught SyntaxError: Invalid or unexpected token

Workaround

The leaflet or other plugins should not load entire JS scripts in a ShortCode.

That is the core issue, which happens to manifest in a View loop because it has a special way of rendering a shortcode (several times).

We suggest asking the plugin developer to if possible not output JS in the ShortCode, which can potentially break other render mechanisms

Leave
a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>