marko-js / marko

A declarative, HTML-based language that makes building web apps fun
https://markojs.com/
MIT License
13.28k stars 641 forks source link

JavaScript Error on Mobile Docs Site #909

Closed eltimn closed 6 years ago

eltimn commented 6 years ago

There's a JavaScript error on the docs site when clicking on the menu dropdown (hamburger icon) when viewed on small screens:

docs-fcaf4305.js:14 Uncaught TypeError: Cannot read property '0' of null
at d (docs-fcaf4305.js:14)
at HTMLBodyElement.<anonymous> (docs-fcaf4305.js:14)
austinkelleher commented 6 years ago

Thanks for the report @eltimn. This looks like a bug in Marko. Will investigate.

jlopezxs commented 6 years ago

Yes is a error in marko in the event-delegation component. The bug was added in version v4.5.0-beta.0, in v4.4.28 works well. But I didn't found how to fix that I think is in components/util-browser in the method of attachBubblingEvent.

patrick-steele-idem commented 6 years ago

@austinkelleher Will you be publishing the fix?

cravindra commented 6 years ago

Hello. I'm facing a similar and possibly related issue. Adding this here to provide context to help anyone looking at this.

Binding an event using on-click throws an error in a component if the component is split component but works as expected if it not split.

Have created a MVP Express + Lasso + Marko app which reproduces this for illustration: https://github.com/cravindra/marko-error-sample

Using @jlopezxs suggestion to downgrade to 4.4.28 worked but that made other features like using *:scoped on attributes stop working.

Dependencies as featured in package.json:

{
    "express": "^4.16.2",
    "lasso": "^2.11.20",
    "lasso-marko": "^2.3.1",
    "marko": "^4.5.5"
}

Stack Trace on the Browser:

template-3e4cf51f.js:1702 Uncaught TypeError: Cannot read property '0' of null
    at delegateEvent (template-3e4cf51f.js:1702)
    at HTMLBodyElement.<anonymous> (template-3e4cf51f.js:1755)

Update: Tried 4.5.0 it works as expected there but the *:scoped feature stops working. Tried 4.5.1 and it breaks there but *:scoped feature works

austinkelleher commented 6 years ago

Published marko@4.5.6 with a fix. Let us know if you see any other issues.

austinkelleher commented 6 years ago

Also markojs.com on mobile is also fixed.

cravindra commented 6 years ago

v4.5.6 works as expected. Thanks for the quick fix @austinkelleher

eltimn commented 6 years ago

Excellent. Thanks.