|
|
|
|
|
by mannix
4707 days ago
|
|
I have a question, since this has been bugging me with other js MV* frameworks lately... Is the set() method necessary for updating single attribute? All browsers have supported getter/setter APIs (__defineGetter__ and Object.defineProperty), why not take advantage of them? Being able to say this would be cool: div.color = 'blue';
instead of: div.set({ color: 'blue' }); or div.set('color', 'blue');
Or would this cause other problems that I'm not thinking of?Edit: my ruby cap is on a little tight today. Javascript programmers might not expect extra logic to be run just by updating a property. I still think it would be cool though :) |
|
No one should use __defineGetter__ and __defineSetter__ because they are non-standard and deprecated[1].
[0] http://kangax.github.io/es5-compat-table/#define-property-ie...
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Edit: left this tab open and I see this point has since been made, but I will leave the comment anyways.