Skip to content
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

add current element to in-element #1575

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class DebugRenderTreeTest extends RenderTest {
type: 'keyword',
name: 'in-element',
args: { positional: [this.element.firstChild], named: {} },
instance: (instance: GlimmerishComponent) => instance === null,
instance: (instance: any) => instance === null,
template: null,
bounds: this.elementBounds(this.element.firstChild! as unknown as Element),
children: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface RenderNode {
args: CapturedArguments;
instance: unknown;
template?: string | undefined;
meta?: Record<string, any>;
}

export interface CapturedRenderNode {
Expand All @@ -26,6 +27,7 @@ export interface CapturedRenderNode {
args: Arguments;
instance: unknown;
template: string | null;
meta: Record<string, any> | null;
bounds: null | {
parentElement: SimpleElement;
firstNode: SimpleNode;
Expand Down
3 changes: 3 additions & 0 deletions packages/@glimmer/runtime/lib/compiled/opcodes/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ APPEND_OPCODES.add(Op.PushRemoteElement, (vm) => {
name: 'in-element',
args,
instance: null,
meta: {
parentElement: vm.elements().element,
},
});

registerDestructor(block, () => {
Expand Down
14 changes: 12 additions & 2 deletions packages/@glimmer/runtime/lib/debug-render-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,21 @@ export default class DebugRenderTreeImpl<TBucket extends object>

private captureNode(id: string, state: TBucket): CapturedRenderNode {
let node = this.nodeFor(state);
let { type, name, args, instance, refs } = node;
let { type, name, args, instance, refs, meta = null } = node;
let template = this.captureTemplate(node);
let bounds = this.captureBounds(node);
let children = this.captureRefs(refs);
return { id, type, name, args: reifyArgsDebug(args), instance, template, bounds, children };
return {
id,
type,
name,
args: reifyArgsDebug(args),
instance,
template,
bounds,
children,
meta,
};
}

private captureTemplate({ template }: InternalRenderNode<TBucket>): Nullable<string> {
Expand Down
Loading