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

[perf | trim] Remove extra class #1510

Merged
Merged
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
19 changes: 0 additions & 19 deletions packages/@glimmer/runtime/lib/bounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,6 @@ export class ConcreteBounds implements Bounds {
}
}

export class SingleNodeBounds implements Bounds {
constructor(
private parentNode: SimpleElement,
private node: SimpleNode
) {}

parentElement(): SimpleElement {
return this.parentNode;
}

firstNode(): SimpleNode {
return this.node;
}

lastNode(): SimpleNode {
return this.node;
}
}

export function move(bounds: Bounds, reference: Nullable<SimpleNode>): Nullable<SimpleNode> {
let parent = bounds.parentElement();
let first = bounds.firstNode();
Expand Down
7 changes: 4 additions & 3 deletions packages/@glimmer/runtime/lib/vm/element-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { assert, expect, Stack } from '@glimmer/util';

import type { DynamicAttribute } from './attributes/dynamic';

import { clear, ConcreteBounds, CursorImpl, SingleNodeBounds } from '../bounds';
import { clear, ConcreteBounds, CursorImpl } from '../bounds';
import { dynamicAttribute } from './attributes/dynamic';

export interface FirstNode {
Expand Down Expand Up @@ -296,7 +296,8 @@ export class NewElementBuilder implements ElementBuilder {
this.dom.insertBefore(this.element, fragment, this.nextSibling);
return ret;
} else {
return new SingleNodeBounds(this.element, this.__appendComment(''));
const comment = this.__appendComment('');
return new ConcreteBounds(this.element, comment, comment);
}
}

Expand All @@ -322,7 +323,7 @@ export class NewElementBuilder implements ElementBuilder {

appendDynamicNode(value: SimpleNode): void {
let node = this.__appendNode(value);
let bounds = new SingleNodeBounds(this.element, node);
let bounds = new ConcreteBounds(this.element, node, node);
this.didAppendBounds(bounds);
}

Expand Down