On 7/20/11 7:17 PM, Boris Zbarsky wrote:
On 7/20/11 4:14 PM, Ryosuke Niwa wrote:
I'm not sure if we can have a concept of atomicity in DOM. Boris might
have a strong opinion on this.
I don't yet.
What I do have a strong opinion on is that it would be good to have
some data on how common "move" operations are compared to "remove" and
"insert" on the web. Then we'll at least know how common or edge-case
the situation is and hence how much effort we should spend on
optimizing for it...
-Boris
I agree that it would be good to have data. All I have is the intuition
that moves in the form of reparenting elements is fairly common. I
assume that there is a lot of code out there that dynamically decorates
static content (to add hyperlinks, animation, etc.) by reparenting that
content into a container element using some variation on this basic code:
var container = document.createElement('div');
parent.insertBefore(container, target);
container.appendChild(target);
But you're right that this might be an edge case that is not worth
optimizing. If "reparent" events are treated as a new category of
mutation events, then they can be added later, if needed, since Jonas's
proposal allows for that sort of extension.
David