-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Custom Elements are gaining traction as the best way to create interoperable components for web. Ionic, the popular mobile framework, is being rewritten with custom elements. Angular is making Custom Element a first class citizen.
By migrating to Custom Element, Marionette would align with current web development technology and opens the door to easier interoperability. The code would be simplified a lot since Custom Elements already implement features like attach/detach(connect/disconnect) lifecycle events.
Implementation could be done with class mixins like is skatejs and elix are doing.
SkateJS allows to customize the rendering with a similar concept as Marionette setRenderer, using mixins instead of a class method.
Marionette would provide withEvents, withUI, withBehaviors etc mixins with each functionality implemented and a withView mixin with all features. This would allow to customize the View class as needed.
The default one should be:
import {withView} from 'marionette'
const View = withView()
if only events is used the user could do
import {withEvents} from 'marionette'
const SimpleView = withEvents()
Is has some drawbacks like being a big breaking
Pros
- Align with current web technology
- Remove hard dependency on Backbone
- Less/simplified code
- First class interoperability with other frameworks
Cons
- Big breaking change
- No destroy lifecycle for view
- Not possible to create a CollectionView with ul/li tags (the custom element name must be separated by a dash)