Skip to content

Commit bf47c79

Browse files
authored
Merge pull request #4557 from Polymer/minor-docs-fixes
Minor doc fixes.
2 parents 053ac15 + 0b00f2d commit bf47c79

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

lib/elements/dom-repeat.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@
157157

158158
/**
159159
* The name of the variable to add to the binding scope with the index
160-
* for the inst. If `sort` is provided, the index will reflect the
161-
* sorted order (rather than the original array order).
160+
* of the instance in the sorted and filtered list of rendered items.
161+
* Note, for the index in the `this.items` array, use the value of the
162+
* `itemsIndexAs` property.
162163
*/
163164
indexAs: {
164165
type: String,
@@ -167,8 +168,9 @@
167168

168169
/**
169170
* The name of the variable to add to the binding scope with the index
170-
* for the inst. If `sort` is provided, the index will reflect the
171-
* sorted order (rather than the original array order).
171+
* of the instance in the `this.items` array. Note, for the index of
172+
* this instance in the sorted and filtered list of rendered items,
173+
* use the value of the `indexAs` property.
172174
*/
173175
itemsIndexAs: {
174176
type: String,

lib/utils/debounce.html

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,28 @@
6868
}
6969
/**
7070
* Creates a debouncer if no debouncer is passed as a parameter
71-
* or it cancels an active debouncer otherwise.
71+
* or it cancels an active debouncer otherwise. The following
72+
* example shows how a debouncer can be called multiple times within a
73+
* microtask and "debounced" such that the provided callback function is
74+
* called once. Add this method to a custom element:
75+
*
76+
* _debounceWork() {
77+
* this._debounceJob = Polymer.Debouncer.debounce(this._debounceJob,
78+
* Polymer.Async.microTask, () => {
79+
* this._doWork();
80+
* });
81+
* }
82+
*
83+
* If the `_debounceWork` method is called multiple times within the same
84+
* microtask, the `_doWork` function will be called only once at the next
85+
* microtask checkpoint.
86+
*
87+
* Note: In testing it is often convenient to avoid asynchrony. To accomplish
88+
* this with a debouncer, you can use `Polymer.enqueueDebouncer` and
89+
* `Polymer.flush`. For example, extend the above example by adding
90+
* `Polymer.enqueueDebouncer(this._debounceJob)` at the end of the
91+
* `_debounceWork` method. Then in a test, call `Polymer.flush` to ensure
92+
* the debouncer has completed.
7293
*
7394
* @param {Polymer.Debouncer?} debouncer Debouncer object.
7495
* @param {!AsyncModule} asyncModule Object with Async interface

test/unit/shady-events.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@
221221

222222
test('scoped focus and blur events do not retarget', function() {
223223
var el = fixture('focus');
224+
var e = new Event('focus');
225+
if (e.isTrused !== false) {
226+
// skip browser if we cannot distinguish
227+
// native focus events from user created ones
228+
this.skip();
229+
}
224230
el.fireScoped();
225231
assert.equal(el.events.length, 1);
226232
assert.equal(el.events[0], el.$.child);

0 commit comments

Comments
 (0)