Feature request: Custom renderer support #2939
dead-claudia
started this conversation in
Ideas
Replies: 2 comments
-
For those of you reading, apologies for the large wall of text. 😄 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Oh, and something I just remembered: this is a revival of a few prior issues here:
It's a near-dupe of all but #10 (which is mostly focused on strings), but I'd rather keep this one alive since it's the most detailed of them all. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
My proposal here is that we should see if we can create an alternate renderer that supports pluggable renderers, rather than just rendering to the DOM directly. There's a few reasons why we should support it in core:
For obvious performance and size reasons, we shouldn't place this in the core bundle. Instead, we should create an alternate
render
implementation specialized for custom renderers.I do get the concern of a lot of duplicate code, but I feel there's enough different fundamentally that the duplication and added complexity is a little more tolerable:
contenteditable
,value
andselectedIndex
for<select>
, and thedocument.activeElement
IE hack are not necessary custom renderers enter the equation.setAttr
andremoveAttr
could be streamlined without all the edge cases that flood that part of the code.The only other modifications required are to 1. move the redraw service to accept a render service parameter instead of creating it directly unnecessarily (
$window
is only used in that one place), and 2. move all the redraw service factory's callers to pass it a render service instead of a rawwindow
value. Incidentally, this would provide a couple benefits of its own:renderService.render
, just returning the hooks that actually deal with redrawing. This consequently makes the code less brittle.Yes, there is a lot of extra complexity, but it's not like some of it couldn't be abstracted out pretty easily - there's a lot of code not touching the closure at all that we could reuse, many of which are already highly tuned:
checkState
callHook
initLifecycle
updateLifecycle
initComponent
(mod an unused return value)updateFragment
getKeyMap
makeLisIndices
getNextSibling
onremove
removeNode
if you abstract this little bit into its own function and pass that as a parameter. (Yes, that little bit could be made more efficient.)shouldNotUpdate
This is not something I want to block v2 (maybe v3), but it's designed to be non-breaking.
Beta Was this translation helpful? Give feedback.
All reactions