yireo / Yireo_Webp2

Magento 2 module to add WebP support to Magento 2
Open Software License 3.0
200 stars 58 forks source link

Javascript error in Hyva template (Unexpected token ')') #148

Closed onlinemusketeers closed 1 year ago

onlinemusketeers commented 1 year ago

Hi Jisse! Thank you 1st of all to use your precious time to look at this. :) I have added here to this issue because

I get this js error on the page: Important to note that this is in a Hyva template.

Thank you Jisse!

evaluator.js:81 Uncaught SyntaxError: Unexpected token ')' at new AsyncFunction (<anonymous>) at evaluator.js:81:20 at _n (evaluator.js:84:28) at hn (evaluator.js:95:16) at ct (evaluator.js:46:21) at g (evaluator.js:26:12) at x-on.js:9:33 at Function.<anonymous> (clone.js:8:57) at r (directives.js:78:88) at n (directives.js:83:62)

Expression: "fullscreen = true; $nextTick(() = loading=" <img :alt=​"image.caption || 'Lion\u0027s\u0020Mane\u0020Hericium\u0020erinaceus\u0020Powder\u0020\u007C\u0020Mushrooms4life\u0020'" :title=​"image.caption || 'Lion\u0027s\u0020Mane\u0020Hericium\u0020erinaceus\u0020Powder\u0020\u007C\u0020Mushrooms4life\u0020'" @click=​"fullscreen = true;​ $nextTick(()​ = loading=" lazy" alt=​"Lion's Mane Hericium erinaceus Powder | Mushrooms4life" title=​"Lion's Mane Hericium erinaceus Powder | Mushrooms4life">​ J @ error.js:12

What browser - Google Chrome on Windows 11 Magento version? - 2.4.4 PHP version? 7.4 Did you make sure to use composer to install all dependencies? yes

Which specific composer version of the Yireo WebP2 extension did you install? 0.12.5 Which specific composer version of the Yireo NextGenImages extension did you install? 0.4.0 Have you tested this after flushing all caches, especially the Full Page Cache? yes Have you tested this after disabling all caches, especially the Full Page Cache? yes Are you testing this in the Developer Mode or in the Production Mode? Dev mode

Preferably post a screenshot with the settings.

Could you please supply a snapshot of the HTML source of a product page? >>

----------- related HTML ---------------

main product photo

<div class="absolute inset-0 hidden w-full h-full bg-white" :class="{ 'hidden': activeVideoType !== 'vimeo' }" x-transition.opacity.duration.500ms x-show=" images[active].type === 'video' && activeVideoType === 'vimeo' "

<div @resize.window.debounce="calcPageSize(); $nextTick(() => calcActive())"> <div id="thumbs" class="flex items-center" :class="{ 'fixed justify-center bottom-0 left-0 right-0 mx-6': fullscreen }" style="min-height: 100px;"

<button aria-label="Previous" tabindex="-1" class="mr-4 text-black rounded-full outline-none focus:outline-none flex-none" :class="{ 'opacity-25 pointer-events-none' : activeSlide === 0, 'hidden' : !isSlider }" @click="scrollPrevious"

<div class="js_thumbs_slides thumbs-wrapper relative flex flex-nowrap w-full overflow-auto js_slides snap md:px-1 xl:px-2" x-ref="jsThumbSlides" @scroll.debounce="calcPageSize(); calcActive()"

<button aria-label="Next" tabindex="-1" class="ml-4 text-black rounded-full outline-none focus:outline-none flex-none" :class="{ 'opacity-25 pointer-events-none' : activeSlide >= itemCount-pageSize, 'hidden' : !isSlider }" @click="scrollNext"

onlinemusketeers commented 1 year ago

It looks like that a regex is having problem with <button @click="fullscreen = false; $nextTick(() => calcPageSize())" it eats a piece of (mjummm) $nextTick(() => probl. sees it as the closing tag of the <img

onlinemusketeers commented 1 year ago