google / incremental-dom

An in-place DOM diffing library
http://google.github.io/incremental-dom/
Apache License 2.0
3.54k stars 180 forks source link

Cache NamedNodeMap.length #375

Closed jridgewell closed 6 years ago

jridgewell commented 6 years ago

Caches the NamedNodeMap (Element#attributes array) length, which is faster on Chrome and Safari.

iteriani commented 6 years ago

Seems OK (I'd leave a comment in case someone tries to remove it), though I'd expect jscompiler to do this for you.

sparhami commented 6 years ago

A comment would be nice, especially since we don't do this in other places (for normal Arrays).

I'm not sure that Closure Compiler will make this optimization for you.

jridgewell commented 6 years ago

Added a comment.