Thank you for class!
I spent some time to get it work at v4.
Finally - at v4 is no nodes attributes. So to get it work - just replace
node.attributes to
node.data