Skip to content

Commit

Permalink
Merge pull request #6 from pepsico-ecommerce/tooltip-attribute-fix
Browse files Browse the repository at this point in the history
tooltip attribute fix
  • Loading branch information
Tatiandad authored May 11, 2021
2 parents 4d4a2dc + e76e7ae commit 0d2d2d7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ define('pep-p', {
// Create a copy of the children and text before we start modifying it.
this.originalChildNodes = Array.from(this.childNodes).map(node => node.cloneNode(true));
this.originalTextContent = this.textContent;
// this.setAttribute('tooltip', this.originalTextContent.trim());
this.setAttribute('tooltip', this.originalTextContent.trim());
this.trimTextContent();
},
disconnected() {
Expand Down Expand Up @@ -71,6 +71,10 @@ define('pep-p', {
this.restoreChildren();
this.trimTextContent();

if (!this.didTrim) {
this.removeAttribute('tooltip');
}

if (this.didTrim) {
this.setAttribute('tooltip', this.originalTextContent.trim());
}
Expand Down

0 comments on commit 0d2d2d7

Please sign in to comment.