weepy / o_O

Funnyface: HTML binding for teh lulz
http://weepy.github.com/o_O/
MIT License
149 stars 11 forks source link

support generic attribute binding #7

Closed troygoode closed 12 years ago

troygoode commented 12 years ago

support the following use case:

<a bind='text: myText(); href: myUrl()' />

currently it will fail when it tries to bind "href" because there is no specific binding configured for it in o_O.bindings

weepy commented 12 years ago

btw - there's no need to add o_O.bindings.attr - since that already works - using the jQuery attr. <div bind='attr: {id : myId() }' />

On Thu, Mar 15, 2012 at 1:45 PM, Troy Goode reply@reply.github.com wrote:

support the following use case:

<a bind='text: myText(); href: myUrl()' />

currently it will fail when it tries to bind "href" because there is no specific binding configured for it in o_O.bindings

You can merge this Pull Request by running:

 git pull https://github.com/TroyGoode/o_O master

Or you can view, comment on it, or merge it online at:

 https://github.com/weepy/o_O/pull/7

-- Commit Summary --

  • Added a new binding (not yet usable) that updates an unknown attribute on the bound element.
  • if no specific binder is found, bind the value to whatever attr was specified on the element
  • fixed a comment I had copy & pasted

-- File Changes --

M lib/binding.js (7) M lib/bindings.js (8)

-- Patch Links --

 https://github.com/weepy/o_O/pull/7.patch  https://github.com/weepy/o_O/pull/7.diff


Reply to this email directly or view it on GitHub: https://github.com/weepy/o_O/pull/7

troygoode commented 12 years ago

ahhh, interesting. might be another good tip for the example app

On Thu, Mar 15, 2012 at 10:07 AM, weepy < reply@reply.github.com

wrote:

btw - there's no need to add o_O.bindings.attr - since that already works - using the jQuery attr. <div bind='attr: {id : myId() }' />

On Thu, Mar 15, 2012 at 1:45 PM, Troy Goode reply@reply.github.com wrote:

support the following use case:

<a bind='text: myText(); href: myUrl()' />

currently it will fail when it tries to bind "href" because there is no specific binding configured for it in o_O.bindings

You can merge this Pull Request by running:

git pull https://github.com/TroyGoode/o_O master

Or you can view, comment on it, or merge it online at:

https://github.com/weepy/o_O/pull/7

-- Commit Summary --

  • Added a new binding (not yet usable) that updates an unknown attribute on the bound element.
  • if no specific binder is found, bind the value to whatever attr was specified on the element
  • fixed a comment I had copy & pasted

-- File Changes --

M lib/binding.js (7) M lib/bindings.js (8)

-- Patch Links --

https://github.com/weepy/o_O/pull/7.patch https://github.com/weepy/o_O/pull/7.diff


Reply to this email directly or view it on GitHub: https://github.com/weepy/o_O/pull/7


Reply to this email directly or view it on GitHub: https://github.com/weepy/o_O/pull/7#issuecomment-4520167

troygoode commented 12 years ago

although I have to say I like the syntax that o_O.bindings.attr gives us better... it works like you'd expect it to

On Thu, Mar 15, 2012 at 10:11 AM, Troy Goode troygoode@gmail.com wrote:

ahhh, interesting. might be another good tip for the example app

On Thu, Mar 15, 2012 at 10:07 AM, weepy < reply@reply.github.com

wrote:

btw - there's no need to add o_O.bindings.attr - since that already works - using the jQuery attr. <div bind='attr: {id : myId() }' />

On Thu, Mar 15, 2012 at 1:45 PM, Troy Goode reply@reply.github.com wrote:

support the following use case:

<a bind='text: myText(); href: myUrl()' />

currently it will fail when it tries to bind "href" because there is no specific binding configured for it in o_O.bindings

You can merge this Pull Request by running:

git pull https://github.com/TroyGoode/o_O master

Or you can view, comment on it, or merge it online at:

https://github.com/weepy/o_O/pull/7

-- Commit Summary --

  • Added a new binding (not yet usable) that updates an unknown attribute on the bound element.
  • if no specific binder is found, bind the value to whatever attr was specified on the element
  • fixed a comment I had copy & pasted

-- File Changes --

M lib/binding.js (7) M lib/bindings.js (8)

-- Patch Links --

https://github.com/weepy/o_O/pull/7.patch https://github.com/weepy/o_O/pull/7.diff


Reply to this email directly or view it on GitHub: https://github.com/weepy/o_O/pull/7


Reply to this email directly or view it on GitHub: https://github.com/weepy/o_O/pull/7#issuecomment-4520167

weepy commented 12 years ago

yes - tho you can't set multiple attributes - i'd like to adhere to jQuery where possible. i like your 'if binding doesnt exist - then bind to that attribute' idea tho. Means we can get rid of the id, class, href bindings I added

weepy commented 12 years ago

ok added