Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Polymer/lit-html into tt
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuel Tesar committed Aug 23, 2019
2 parents 87da158 + bddd60f commit 5dd0858
Show file tree
Hide file tree
Showing 9 changed files with 1,548 additions and 1,053 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
Unreleased section, uncommenting the header as necessary.
-->

## Unreleased
<!-- ## Unreleased -->
<!-- ### Changed -->
<!-- ### Added -->
<!-- ### Removed -->
<!-- ### Fixed -->

## [1.1.2] - 2019-08-12

### Fixed
* Fixed a bug where bindings in comments could be written as text in some cases. ([#926](https://github.com/Polymer/lit-html/issues/926))
Expand Down
6 changes: 3 additions & 3 deletions docs/_guide/03-styling-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ The [ShadyCSS README](https://github.com/webcomponents/shadycss#usage) provides
```js
connectedCallback() {
super.connectedCallback();
if (window.shadyCSS !== undefined) {
window.shadyCSS.styleElement(this);
if (window.ShadyCSS !== undefined) {
window.ShadyCSS.styleElement(this);
}
}
```
Expand Down Expand Up @@ -144,4 +144,4 @@ const itemTemplate = (item) => {
}
```
More information: see [classMap](template-reference#classmap) in the Template syntax reference.
More information: see [classMap](template-reference#classmap) in the Template syntax reference.
19 changes: 16 additions & 3 deletions docs/_guide/06-template-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ The `cache` directive caches the generated DOM for a given binding and input tem

`class=${classMap(classObj)}`

Location: attribute bindings (must be the entire value of the `class` attribute)
Location: attribute bindings (must be the only binding in the `class` attribute)

Sets a list of classes based on an object. Each key in the object is treated as a class name, and if the value associated with the key is truthy, that class is added to the element.

Expand All @@ -361,6 +361,13 @@ html`<div class=${classMap(classes)}>Classy text</div>`;
// renders as <div class="highlight enabled">Classy text</div>
```

The `classMap` must be the only binding in the `class` attribute, but it can
be combined with static values:

```js
html`<div class="my-widget ${classMap(dynamicClasses)}">Static and dynamic</div>`;
```

### ifDefined

`ifDefined(value)`
Expand Down Expand Up @@ -449,7 +456,7 @@ of when to use `repeat` and when to use standard JavaScript flow control.

`style=${styleMap(styles)}`

Location: attribute bindings (must be the entire value of the `style` attribute)
Location: attribute bindings (must be the only binding in the `style` attribute)

The `styleMap` directive sets styles on an element based on an object, where each key in the object is treated as a style property, and the value is treated as the value for that property. For example:

Expand All @@ -467,7 +474,13 @@ For CSS properties that contain dashes, you can either use the camel-case equiva
{ 'font-family': 'roboto' }
```

The `styleMap` directive can only be used as a value for the `style` attribute, and it must be the entire value of the attribute.
The `styleMap` must be the only binding in the `style` attribute, but it can
be combined with static values:

```js
html`<p style="color: white; ${styleMap(moreStyles)}">More styles!</p>`;
```


### unsafeHTML

Expand Down
Loading

0 comments on commit 5dd0858

Please sign in to comment.