Skip to content

Commit 02e2f14

Browse files
committed
super it and put back takeRecords
1 parent 15cbdff commit 02e2f14

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

lib/mixins/dir-mixin.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,19 @@
4444
}
4545

4646
function updateDirection() {
47+
getRTL();
4748
DOCUMENT_DIR = document.documentElement.getAttribute('dir');
4849
for (let i = 0; i < DIR_INSTANCES.length; i++) {
4950
setRTL(DIR_INSTANCES[i]);
5051
}
5152
}
5253

54+
function takeRecords() {
55+
if (observer && observer.takeRecords().length) {
56+
updateDirection();
57+
}
58+
}
59+
5360
/**
5461
* Element class mixin that allows elements to use the `:dir` CSS Selector to have
5562
* text direction specific styling.
@@ -133,22 +140,22 @@
133140
this.__autoDirOptOut = /** @type {!HTMLElement} */(this).hasAttribute('dir');
134141
}
135142

136-
/** @suppress {missingProperties} Closure's understanding of prototypes is bad */
143+
/** @suppress {missingProperties} If it exists on elementBase, it can be super'd */
137144
connectedCallback() {
138145
if (elementBase.prototype.connectedCallback) {
139-
/** @type {!Polymer_ElementMixin} */(elementBase).prototype.connectedCallback.call(this);
146+
super.connectedCallback();
140147
}
141148
if (this.constructor.__activateDir) {
149+
takeRecords();
142150
DIR_INSTANCES.push(this);
143-
getRTL();
144151
setRTL(this);
145152
}
146153
}
147154

148-
/** @suppress {missingProperties} Closure's understanding of prototypes is bad */
155+
/** @suppress {missingProperties} If it exists on elementBase, it can be super'd */
149156
disconnectedCallback() {
150157
if (elementBase.prototype.disconnectedCallback) {
151-
/** @type {!Polymer_ElementMixin} */(elementBase).prototype.disconnectedCallback.call(this);
158+
super.disconnectedCallback();
152159
}
153160
if (this.constructor.__activateDir) {
154161
const idx = DIR_INSTANCES.indexOf(this);

0 commit comments

Comments
 (0)