marko-js-archive / marko-widgets

[LEGACY] Module to support binding of behavior to rendered UI components rendered on the server or client
http://v3.markojs.com/docs/marko-widgets/
MIT License
141 stars 40 forks source link

Macro tag doesn't play well with w-bind / widget #158

Open BryceEWatson opened 8 years ago

BryceEWatson commented 8 years ago

\ Update: Moving the macro inside the w-bind does work. So maybe this is a low-priority feature request instead of a bug 😄

The following case throws an error:

<macro test()>
    <input w-onchange="doSomething" />
</macro>
<div w-bind>
    <test()/>
</div>

Error:

Error: An error occurred while trying to compile template at path "xxxxxx/template.marko". Error(s) in template:
1) [xxxxxx/template.marko:7:8] Unable to handle event ""change"". HTML element is not nested within a widget.

   at Compiler.compile (xxxx/node_modules/marko/compiler/Compiler.js:124:25)
   at Object.compile (xxxx/node_modules/marko/compiler/index.js:116:25)
   at compile (xxxx/node_modules/marko/node-require.js:54:38)
   at Object.markoExtension [as .marko] (xxxx/node_modules/marko/node-require.js:108:27)