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
142 stars 40 forks source link

w- prefix #155

Closed NickColley closed 7 years ago

NickColley commented 7 years ago

I'm guessing the prefix stands for 'Widget?', is there a reason that they need to be prefixed?

(Sorry for the stupid question :))

patrick-steele-idem commented 7 years ago

Standard HTML attributes such as onclick="handleFooClick()" always passthrough untouched, but Marko Widgets has special compile-time handling for w-onclick="handleFooClick". We use the w- prefix as a way to namespace non-standard HTML attributes that are specially handled by Marko Widgets while letting standard HTML continue to behave exactly as expected. We didn't want to hijack standard HTML attributes and change their behavior.

And yes, the w- prefix is short for "widget-" as indicator that the attribute is handled by Marko Widgets.

Hope that answers your question. I'm going to close the issue but feel free to add more comments here or reopen if you feel compelled :)