marko-js / marko

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

Important piece of syntax seems to be undocumented #838

Closed callumlocke closed 6 years ago

callumlocke commented 6 years ago

It's possible I'm missing something obvious, but I've just spent the last hour trying to find out how to access attribute values from inside a custom tag, and it seems to be undocumented.

<p><my-tag foo=123></p>

// how do you access `foo` inside ./components/my-tag.marko ?
<span>foo is ${??????}</span>

After trial and error, it seems to be available as data.foo, but I can't find any mention of this in the docs.

austinkelleher commented 6 years ago

Hey @callumlocke, accessing the input via the data property is deprecated. You should use input.foo instead. input and data function identically. It was just a rename. Here is the mention of input in the docs: http://markojs.com/docs/components/#codethisinputcode. I'm going to go ahead and close this out. Let us know if you have any additional questions.

Also, it's always super helpful when we get feedback like this. If you feel that there are some places that need clarification as you're reading through the docs, please feel free to update them! PRs are welcome! Thanks. https://github.com/marko-js/marko/tree/master/docs

callumlocke commented 6 years ago

Weird, I started on this because input wasn't working. Maybe I was doing something else wrong. Thanks