Re: [whatwg/dom] Add NodeList.setAttributes (#895)

@michaschwab,  thanks for your feedback on the template parts proposal. I see your point about the differences between that proposal and what this issue is tackling. 

I see two main pain points this proposal addresses, performance and ergonomics. Regarding performance, I'm not sure how much improvement can be achieved. 

 > often over 20ms in real world applications that update only a handful of attributes, but on thousands of nodes

The example in a comment, https://github.com/whatwg/dom/issues/895#issuecomment-714582150, shows that each attribute's value is different for each node. So unless the API supports passing-in a set of attributes for each node, the script will still have to loop over each node, and bulk set its attributes. The performance benefit will be not needing to loop over each attribute for a given node.

Is this analysis correct, or have I misunderstood the API shape? 

As for ergonomics, I like  @LeaVerou's and your comment about a static method. Converting a Nodelist to an Array and vise versa is not straight forward. The static method solves that. 




-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/895#issuecomment-733444303

Received on Wednesday, 25 November 2020 03:45:00 UTC