All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Added interop with the proposed Trusted Types spec: https://github.com/WICG/trusted-types (#970)
- Added a sanitization system, for integrating with DOM value sanitizers to prevent XSS attacks. See the docs on the SanitizerFactory type and the setSanitizerFactory function for details.
- Fixed a bug where
classMap
andstyleMap
directives wouldn't render mutated objects. (#972)
- Fixed a bug where bindings in comments could be written as text in some cases. (#926)
render
andshady-render
now both accept any value that is renderable byNodePart
. (#910)
- Many small performance enhancements.
- Private names are now named with a
__
prefix (#859).
- Setup continuous benchmarking with Tachometer (#887).
- Prevent empty styles from causing exceptions or breaking rendering when using
shady-render
(#760). - Primitive values in attributes are now always simply stringified, regardless of whether they are iterable. (#830)
- Adopt and upgrade template fragments after processing for parts (#831).
- Fixed bindings with attribute-like expressions preceeding them (#855).
- Fixed errors with bindings in HTML comments (#882).
- Tons of docs updates (#746), (#675), (#724), (#753), (#764), (#763), (#765), (#767), (#768), (#734), (#771), (#766), (#773), (#770), (#769), (#777), (#776), (#754), (#779)
- Global version of
lit-html
on window (#790).
- Removed use of
any
outside of test code (#741).
- Performance improvements to template processing. (#690)
- Added the
nothing
sentinel value which can be used to clear a part. (#673)
- Fixed #702: a bug with the
unsafeHTML
directive when changing between unsafe and other values. (#703) - Fixed #708: a bug with the
until
directive where placeholders could overwrite resolved Promises. (#721)
- Documentation updates.
- Fixed typing for template_polyfill
createElement
call.
until()
can now take any number of sync or async arguments. (#555)- [Breaking]
guard()
supports multiple dependencies. If the first argument toguard()
is an array, the array items are checked for equality to previous values. (#666) - [Breaking] Renamed
classMap.js
andstyleMap.js
files to kebab-case. (#644)
- Added
cache()
directive. (#646) - Removed Promise as a supposed node-position value type. (#555)
- Added a minimal
<template>
polyfill.
- [Breaking] Removed the
when()
directive. Users may achieve similar behavior by wrapping a ternary with thecache()
directive.
- Bound attribute names are rewritten to avoid IE/Edge removing SVG and style attributes. (#640)
- Ensure shady-render prepares styling for a scope before attaching child elements. (#664)
- Handle CSS Custom Variables in the styleMap directive. #642)
- [Breaking] Directives are now defined by passing the entire directive factory function to
directive()
. (#562)
- Fix issue on obscure browsers that do not accept event listener objects by using callback as event part listener (#581)
- Fix KeyFn and ItemTemplate types (#570)
- Don't use export * to workaround rollup bug (#556)
eventContext
is no longer used as thethis
value for event listener objects (object with ahandleEvent
method), as the object itself is supposed to be thethis
value. (#576)
- Re-implemented repeat directive for better performance (#501)
- Updated TypeScript dependency to 3.1
- [Breaking]
render()
now takes an options object as the third argument. (#523)
- Event listeners are called with a configurable
this
reference, which is set via theeventContext
option torender()
. (#523) - Support for event listener options, by passing the listener itself as both the second and third arguments to add/removeEventListener().
- Moved upgrading of custom elements in template fragments to a common location in TemplateInstance (#489)
- Rewrite render() to reuse the logic in NodePart. render() now supports all the data types that NodeParts do. (#491)
- Fixed bug when using the ShadyCSS @apply` shim. (#502)
- Added
classMap
andstyleMap
directives (#486)
- Fixed bug in asyncReplace when rerendering the same iterable (#485)
- Update properties before upgrading custom elements (#455)
- Cache the ShadyCSS version lookup (#477)
- Eliminated a cycle in the module import graph (#472)
- Remove the default value for the templateProcessor parameter in TemplateResult#constuctor, making it a required paremeter (#472)
- Added support for property, event, and boolean bindings to default syntax (#398)
- Added guard directive (#438)
- Added when directive (#439)
- Split implementation into multiple small modules and merged lit-html.js and core.js (#436)
- Moved directives into top-level
directives/
directory (#436) - Replaced
PartCallback
withTemplateProcessor
(#405) - Unified
NodePart
andAttributePart
interfaces (#400)- AttributePart#setValue() takes a single value
Part
has separatesetValue()
andcommit()
phases- Added
AttributeCommitter
to commit attribute values once for multipleAttributeParts
- Removed lit-extended.js (#436)
- Render initial undefined values in attributes (#377)
- Handle case-sensitive attributes like
viewBox
correctly (#376) - Support bindings in
<template>
elements (#343) - Don’t break templates when HTML comments have bindings in them (#446)
- IE: Don't use Set() constructor arguments (#401)
- Handle forms as Node instead of iterable (#404)
- Update values after upgrading custom elements (#385)
- Dirty check primitive values passed to unsafeHTML() (#384)
- Handle forms as Node instead of iterable (#404)
- Upgrade disconnected custom elements before setting properties on them. (#442)
- Fix style attribute bindings in IE (#448)
- Added
noChange
- Value in favour ofdirectiveValue
(deprecated).- A
noChange
- Value signals that a value was handled by a directive and should not be written to the DOM
- A
- Updated shady-render to render styles in order, work with
@apply
, and work in browers where CSS Custom Properties must be polyfilled, like IE 11. - Introduced API to modify template contents safely without breaking template parts
insertNodeIntoTemplate(template: Template, node: Node, refNode: Node|null)
removeNodesFromTemplate(template: Template, nodesToRemove: Set<Node>)
- Added IE11 support
- Declarative events in lit-extended are more efficient when handlers change
- Refactored how template tags and
render()
are implemented so that all specialization of template syntax is done in tags, notrender()
, allowing for the mixining of templates of different syntaxes, and for hooks inrender()
to change templates before they're initially processed. - Added ShadyCSS support in lib/shady-render.js. It's exported render function
will pass templates to ShadyCSS's
prepareTemplate()
function to process style tags and elements in the template for emulate CSS scoping. - lit-extended: Attribute bindings with a
?
suffix on the name now act as boolean attributes. The attribute will be removed for falsey values and set to''
for truthy values, matching the HTML specification behavior for boolean attributes. - Fixed a bug where directives rendered incorrectly on AttributeParts and PropertyParts
- Allow all valid HTML attribute names, including emoji and Angular-style
(foo)=
and[foo]=
names. - Drastically improved performance of the
repeat
directive. - Fixed an issue with expressions directly following elements.
- Fixed numerous bugs with the
repeat
directive. - Performance improvements for template setup
- Internal code cleanup
- Support synchronous thenables
- Added the
asyncAppend
andasyncReplace
directives to handle async iterable values in expressions.
- Added the
svg
template tag for creating partial SVG content - Support for expressions inside tables and other elements with limited permitted content
- Only remove whitespace between elements, or at the start or end of elements
- Fixed bugs with rendering iterables
- A few IE/Edge fixes. Closer to full support.
- Fixed removing event handlers when setting them to
undefined
. - Allow the text "{{}}" to appear in templates.
- Optimized clearing of Parts.
- Added
unsafeHTML()
directive to bind values as HTML source. - Optimizations, simplification and bug fixes of Array handling code.
- Update to extension API: added partCallback parameter to
render()
. - Added the
directive()
decorator function to create directives. Functions values are no longer treated as directive by default, simplifying declarative event handlers.