Skip to content

Commit

Permalink
Fix closure annotations for dom-if.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Jul 3, 2019
1 parent 18adf5f commit cee1893
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions lib/elements/dom-if.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,12 @@ import { fastDomIf, strictTemplatePolicy } from '../utils/settings.js';
import { showHideChildren } from '../utils/templatize.js';

/**
* The `<dom-if>` element will stamp a light-dom `<template>` child when
* the `if` property becomes truthy, and the template can use Polymer
* data-binding and declarative event features when used in the context of
* a Polymer element's template.
*
* When `if` becomes falsy, the stamped content is hidden but not
* removed from dom. When `if` subsequently becomes truthy again, the content
* is simply re-shown. This approach is used due to its favorable performance
* characteristics: the expense of creating template content is paid only
* once and lazily.
*
* Set the `restamp` property to true to force the stamped content to be
* created / destroyed when the `if` condition changes.
*
* @customElement
* @polymer
* @extends PolymerElement
* @summary Custom element that conditionally stamps and hides or removes
* template content based on a boolean flag.
* @constructor
* @summary Base class for dom-if element; subclassed into concrete
* implementation.
*/
class DomIfBase extends PolymerElement {

Expand Down Expand Up @@ -628,6 +615,28 @@ class DomIfLegacy extends DomIfBase {
}
}

/**
* The `<dom-if>` element will stamp a light-dom `<template>` child when
* the `if` property becomes truthy, and the template can use Polymer
* data-binding and declarative event features when used in the context of
* a Polymer element's template.
*
* When `if` becomes falsy, the stamped content is hidden but not
* removed from dom. When `if` subsequently becomes truthy again, the content
* is simply re-shown. This approach is used due to its favorable performance
* characteristics: the expense of creating template content is paid only
* once and lazily.
*
* Set the `restamp` property to true to force the stamped content to be
* created / destroyed when the `if` condition changes.
*
* @customElement
* @polymer
* @extends DomIfBase
* @constructor
* @summary Custom element that conditionally stamps and hides or removes
* template content based on a boolean flag.
*/
export const DomIf = fastDomIf ? DomIfFast : DomIfLegacy;

customElements.define(DomIf.is, DomIf);

0 comments on commit cee1893

Please sign in to comment.