Skip to content

Commit 43f5953

Browse files
author
Steve Orvell
authored
Merge pull request #163 from Polymer/documentation-fixes
Documentation typo fixes and clarifications
2 parents 62d378d + cb99509 commit 43f5953

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ and renders declaratively using `lit-html`.
4343
* `reflect`: Indicates if the property should reflect to an attribute.
4444
If `true`, when the property is set, the attribute is set using the
4545
attribute name determined according to the rules for the `attribute`
46-
propety option and the value of the property serialized using the rules from
46+
property option and the value of the property serialized using the rules from
4747
the `type` property option.
4848
* `hasChanged`: A function that indicates if a property should be considered
4949
changed when it is set. The function should take the `newValue` and `oldValue`
@@ -161,7 +161,7 @@ into the element. This is the only method that must be implemented by subclasses
161161

162162
* `update(changedProperties)` (protected): This method calls `render()` and then uses `lit-html`
163163
in order to render the template DOM. It also updates any reflected attributes based on
164-
property values. Setting properties inside this method will *not* trigger another update..
164+
property values. Setting properties inside this method will *not* trigger another update.
165165

166166
* `firstUpdated(changedProperties)`: (protected) Called after the element's DOM has been
167167
updated the first time, immediately before `updated()` is called.
@@ -175,8 +175,8 @@ into the element. This is the only method that must be implemented by subclasses
175175

176176
* `updateComplete`: Returns a Promise that resolves when the element has completed
177177
updating. The Promise value is a boolean that is `true` if the element completed the
178-
update without triggering another update. This happens if a property is set inside
179-
`updated()`. This getter can be implemented to await additional state.
178+
update without triggering another update. The Promise result is `false` if a
179+
property was set inside `updated()`. This getter can be implemented to await additional state.
180180
For example, it is sometimes useful to await a rendered element before fulfilling
181181
this Promise. To do this, first await `super.updateComplete` then any subsequent state.
182182

@@ -195,14 +195,15 @@ into the element. This is the only method that must be implemented by subclasses
195195

196196
## Advanced: Update Lifecycle
197197

198-
* When the element is first connected or a property is set (e.g. `element.foo = 5`)
199-
and the property's `hasChanged(value, oldValue)` returns `true`.
198+
* A property is set (e.g. `element.foo = 5`).
199+
* If the property's `hasChanged(value, oldValue)` returns `false`, the element does not
200+
update. If it returns `true`, `requestUdpate()` is called to schedule an update.
200201
* `requestUpdate()`: Updates the element after awaiting a [microtask](https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/) (at the end
201202
of the event loop, before the next paint).
202203
* `shouldUpdate(changedProperties)`: The update proceeds if this returns `true`, which
203204
it does by default.
204205
* `update(changedProperties)`: Updates the element. Setting properties inside this
205-
method will *not* trigger the element to update.
206+
method will *not* trigger another update.
206207
* `render()`: Returns a `lit-html` TemplateResult (e.g. <code>html\`Hello ${world}\`</code>)
207208
to render element DOM. Setting properties inside this method will *not* trigger
208209
the element to update.

src/lib/updating-element.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export interface PropertyDeclaration<T = any> {
5959
* Indicates if the property should reflect to an attribute.
6060
* If `true`, when the property is set, the attribute is set using the
6161
* attribute name determined according to the rules for the `attribute`
62-
* propety option and the value of the property serialized using the rules from
62+
* property option and the value of the property serialized using the rules from
6363
* the `type` property option.
6464
*/
6565
reflect?: boolean;
@@ -520,13 +520,13 @@ export abstract class UpdatingElement extends HTMLElement {
520520
}
521521

522522
/**
523-
* Returns a Promise that resolves when the element has completed updating
524-
* that resolves to a boolean value that is `true` if the element completed
525-
* the update without triggering another update. This happens if a property
526-
* is set in `updated()`. This getter can be implemented to await additional
527-
* state. For example, it is sometimes useful to await a rendered element before
528-
* fulfilling this Promise. To do this, first await `super.updateComplete`
529-
* then any subsequent state.
523+
* Returns a Promise that resolves when the element has completed updating.
524+
* The Promise value is a boolean that is `true` if the element completed the
525+
* update without triggering another update. The Promise result is `false` if a
526+
* property was set inside `updated()`. This getter can be implemented to await
527+
* additional state. For example, it is sometimes useful to await a rendered
528+
* element before fulfilling this Promise. To do this, first await
529+
* `super.updateComplete` then any subsequent state.
530530
*
531531
* @returns {Promise} The Promise returns a boolean that indicates if the
532532
* update resolved without triggering another update.

0 commit comments

Comments
 (0)