New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: RendererV2 #14469
feat: RendererV2 #14469
Conversation
@@ -85,16 +85,26 @@ export class DebugElement extends DebugNode { | |||
insertChildrenAfter(child: DebugNode, newChildren: DebugNode[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use insertBefore ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add the breaking change in the commit msg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed.
modules/@angular/core/src/render.ts
Outdated
@@ -7,4 +7,4 @@ | |||
*/ | |||
|
|||
// Public API for render | |||
export {RenderComponentType, Renderer, RootRenderer} from './render/api'; | |||
export {RENDERER_V2_TOKEN, RenderComponentType, Renderer, RendererV2, RootRenderer} from './render/api'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RENDERER_V2_IMPL
@@ -137,7 +137,12 @@ export function createElement(view: ViewData, renderHost: any, def: NodeDef): El | |||
if (view.parent || !rootSelectorOrNode) { | |||
const parentNode = | |||
def.parent != null ? asElementData(view, def.parent).renderElement : renderHost; | |||
el = elDef.name ? renderer.createElement(elDef.name) : renderer.createComment(''); | |||
if (elDef.name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add todo: move in the def
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can fix it later on.
@@ -146,7 +151,8 @@ export function createElement(view: ViewData, renderHost: any, def: NodeDef): El | |||
} | |||
if (elDef.attrs) { | |||
for (let attrName in elDef.attrs) { | |||
renderer.setAttribute(el, attrName, elDef.attrs[attrName]); | |||
const nsAndName = splitNamespace(attrName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add todo everywhere
@@ -180,6 +180,12 @@ export enum RenderNodeAction { | |||
|
|||
export function visitRootRenderNodes( | |||
view: ViewData, action: RenderNodeAction, parentNode: any, nextSibling: any, target: any[]) { | |||
// TODO: this should be done inside of the check for nodeDef.type === Nodetype.Element, ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the todo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explain why, ie used when manually moving view nodes around
|
||
removeClass(el: any, name: string): void { el.classList.remove(name); } | ||
|
||
setStyle(el: any, style: string, value: any): void { el.style[style] = value; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also add priority
arg for styles with important
? https://github.com/angular/angular/pull/13281/files#diff-d8d7af6e45117a338e7c3bdc10701ccfR249
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and support for vendor prefixed/css vars #12847
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the heads up, I'll add the params
* | ||
* @experimental | ||
*/ | ||
export const RENDERER_V2_IMPL = new InjectionToken<RendererV2>('Renderer V2'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to RENDERER_V2_DIRECT
0e532ff
to
1106d20
Compare
|
||
removeClass(el: any, name: string): void { el.classList.remove(name); } | ||
|
||
setStyle(el: any, style: string, value: any, hasVendorPrefix: boolean, hasImportant: boolean): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think signature should be
setStyle(el: any, style: string, value: any, priority?: string)
and impl
setStyle(el: any, style: string, value: any, priority?: string) {
if (style[0] === '-' || priority) {
el.style.setProperty(style, value, priority);
} else {
el.style[style] = value;
}
}
priority?: string
isntead of boolean
because native setProperty
wants a string.
hasVendorPrefix
I think is not necessary because it's just a simple check style[0] === '-'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT - but I see that the api docs are missing. we should add these before the final release.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.