Replies: 2 comments
-
the Riot.js API can not be monkey patched because I don't want that users from third party libraries might interfere with the default behavior of such methods. riot.$ = (selector) => this.root.querySelector(`[${selector}]`) In this case for example this library can completely break your application. A better approach is to add new methods to the Riot.js API in order to enhance your components. Eventually you can rely on components |
Beta Was this translation helpful? Give feedback.
-
@exside I'd be curious what "my additional DOM helpers" actually are? Riot gives you access to the DOM element at |
Beta Was this translation helpful? Give feedback.
-
I think I understand why the riot DOM helpers are frozen and thus can't be modified: To make sure the API of a component can be expected to be identical.
But I find myself having to
riot.install()
my additional DOM helpers almost in every project to some other property thantag.$
because that property can't be modified due toObject.freeze()
. Was wondering if there could be any justification to not freeze the dom helpers OR make this somehow configurable so by default they are frozen but could be made mutable on demand?Beta Was this translation helpful? Give feedback.
All reactions