13 comments

[ 3.1 ms ] story [ 44.5 ms ] thread
This seems like reason enough to prefer using a virtual DOM.
Excuse me sir, have you accepted our lord and savior React.js into your life?
The only thing you need to solve this specific problem is jQuery.
(comment deleted)
No sir, there are many alternatives. I wrote my own.
Is your library public? I'm also implementing my own right now so I am very curious about the different ways people solve this problem.
Ractive.js is nice too.
From the Javascript point of view, isnt it usually better to manipulate dom object properties instead of DOM attributes?
Usually yes. The jQuery docs[0] go into why they refactored their .attr into separate .prop and .attr methods way back when in v1.6.

There are also cases, such as the value property, that will also update the value attribute.

[0] http://api.jquery.com/prop/

The sarcasm is annoying and obscures and cheapens the point you're trying to make.

If the point is good, it will stand on its own. Excess sarcasm just comes off as a crutch.

We didn't like how attributes worked, so we changed it, but then people were using it and now we have to change it back. It's not a particularly good point. I would like to know more about the fundamental problem with existing specs. I've never had a problem with attributes that couldn't be fixed in browser implementation rather than specification, certainly not a "problem" that could only be solved with React or jQuery as suggested in comments. I thought that specs nowadays are modeled after "what works in todays browsers" rather than "what would be better", much like HTML5 is modeled after what works in IE6 (talking about "brave enough"). I also thought that this proposed simplification is already part of DOM4, or did I make that up? Should namespaced attributes simply become unsupported on an API level? That's a cost to pay, much like querySelector comes with the cost of 1) only being able to query the document structure downwards, not upwards, and 2) only being able to query the default namespace. The API may be less awkward, but it introduces problems that are actually problematic, so more arguments would come in handy for me to understand the point.