Skip to content

Commit

Permalink
super it and put back takeRecords
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Oct 14, 2017
1 parent 15cbdff commit 02e2f14
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/mixins/dir-mixin.html
Expand Up @@ -44,12 +44,19 @@
}

function updateDirection() {
getRTL();
DOCUMENT_DIR = document.documentElement.getAttribute('dir');
for (let i = 0; i < DIR_INSTANCES.length; i++) {
setRTL(DIR_INSTANCES[i]);
}
}

function takeRecords() {
if (observer && observer.takeRecords().length) {
updateDirection();
}
}

/**
* Element class mixin that allows elements to use the `:dir` CSS Selector to have
* text direction specific styling.
Expand Down Expand Up @@ -133,22 +140,22 @@
this.__autoDirOptOut = /** @type {!HTMLElement} */(this).hasAttribute('dir');
}

/** @suppress {missingProperties} Closure's understanding of prototypes is bad */
/** @suppress {missingProperties} If it exists on elementBase, it can be super'd */
connectedCallback() {
if (elementBase.prototype.connectedCallback) {
/** @type {!Polymer_ElementMixin} */(elementBase).prototype.connectedCallback.call(this);
super.connectedCallback();
}
if (this.constructor.__activateDir) {
takeRecords();
DIR_INSTANCES.push(this);
getRTL();
setRTL(this);
}
}

/** @suppress {missingProperties} Closure's understanding of prototypes is bad */
/** @suppress {missingProperties} If it exists on elementBase, it can be super'd */
disconnectedCallback() {
if (elementBase.prototype.disconnectedCallback) {
/** @type {!Polymer_ElementMixin} */(elementBase).prototype.disconnectedCallback.call(this);
super.disconnectedCallback();
}
if (this.constructor.__activateDir) {
const idx = DIR_INSTANCES.indexOf(this);
Expand Down

0 comments on commit 02e2f14

Please sign in to comment.