Skip to content

Commit

Permalink
Address feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Orvell committed May 19, 2020
1 parent 8fa8e44 commit e93083e
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/lib/render-lit-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,7 @@ const getTemplate = (result: TemplateResult) => {
};

export type RenderInfo = {
customElementInstanceStack: Array<
{element: HTMLElement; renderer: LitElementRenderer} | undefined
>;
customElementInstanceStack: Array<LitElementRenderer | undefined>;
};

declare global {
Expand Down Expand Up @@ -346,7 +344,7 @@ export function* renderValue(
// the renderLight() method.
const instance = getLast(renderInfo.customElementInstanceStack);
if (instance !== undefined) {
yield* instance.renderer.renderLight(renderInfo);
yield* instance.renderLight(renderInfo);
}
} else if (value === nothing || value === noChange) {
// yield nothing
Expand Down Expand Up @@ -409,7 +407,7 @@ export function* renderTemplateResult(
const propertyName = name.substring(1);
const value = result.values[partIndex];
if (instance !== undefined) {
instance.renderer.setProperty(propertyName, value);
instance.setProperty(propertyName, value);
}
// Property should be reflected to attribute
const reflectedName = reflectedAttributeName(
Expand All @@ -432,7 +430,7 @@ export function* renderTemplateResult(
const value = result.values[partIndex];
if (value) {
if (instance !== undefined) {
instance.renderer.setAttribute(attributeName, value as string);
instance.setAttribute(attributeName, value as string);
}
yield attributeName;
}
Expand All @@ -443,10 +441,7 @@ export function* renderTemplateResult(
partIndex
)}"`;
if (instance !== undefined) {
instance.renderer.setAttribute(
attributeName,
attributeString as string
);
instance.setAttribute(attributeName, attributeString as string);
}
yield attributeString;
}
Expand All @@ -460,8 +455,7 @@ export function* renderTemplateResult(
try {
const element = new ctor();
(element as any).tagName = op.tagName;
const renderer = new LitElementRenderer(element);
instance = {element, renderer};
instance = new LitElementRenderer(element);
} catch (e) {
console.error('Exception in custom element constructor', e);
}
Expand All @@ -471,7 +465,7 @@ export function* renderTemplateResult(
case 'custom-element-render': {
const instance = getLast(renderInfo.customElementInstanceStack);
if (instance !== undefined) {
yield* instance.renderer.renderElement();
yield* instance.renderElement();
}
break;
}
Expand Down

0 comments on commit e93083e

Please sign in to comment.