• Resolved peter

    (@dewebbouwmeester)


    Hello all,

    In version 1.4.4 javascript function pakjegemak() contains a blank line, line 251 in wcmyparcel-writepanel.php. This results in an paragraph end tag </p> in the script as it is rendered on the page, most likely because of wpautop.
    This html tag in the script causes an error. Removing the blank line solves this issue.

    Kind regards,
    Peter

    https://www.ads-software.com/plugins/woocommerce-myparcel/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Ewout

    (@pomegranate)

    Thanks for reporting! I will remove the blank line in the next update. It’s very odd that a paragraph end tag is added – it doesn’t happen in my own install, nor have I received any reports from other users. Is it possible that your theme is doing this autop ? Blank lines are perfectly legal to use in js!

    Ewout

    (@pomegranate)

    Actually, wpautop has built in functionality that should prevent this to happen in the first place:
    https://developer.www.ads-software.com/reference/functions/wpautop/

    if ( $br ) {
    	$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee);
    	$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
    	$pee = str_replace('<WPPreserveNewline />', "\n", $pee);
    }

    So my guess is that it’s not core WordPress doing this…

    Ewout

    Thread Starter peter

    (@dewebbouwmeester)

    Hi Ewout,
    Thanks for your quick reply!
    The plugin is part of quite a large (multisite) installation and there could very well be some other code interfering. I will try if i can find the culprit and let you know.
    I’ll mark this issue as resolved, thanks.
    Kind regards,
    Peter

    Thread Starter peter

    (@dewebbouwmeester)

    Hi Ewout,
    Thanks for pointing me at default wpautop formatting. It made me look at the code base and I indeed found a bespoke function that tempers with the content filters in such a way, that it causes the erroneous paragraph tags. I need to find a way to solve that.
    As it turns out, this also seems to cause the other issue i reported, although I don’t quite understand why yet.
    Kind regards,
    Peter

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Error in javascript function pakjegemak()’ is closed to new replies.