Skip to content

Commit

Permalink
Fix: padding-left set to window width
Browse files Browse the repository at this point in the history
When separateDialCode enabled, plugin initialised while input is hidden, and dev has some custom CSS to make .iti have width:100% then we were setting padding left to the window width.
  • Loading branch information
jackocnr committed May 30, 2020
1 parent 2260f6f commit d9b15b6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
4 changes: 3 additions & 1 deletion build/js/intlTelInput-jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,10 @@
var containerClone = this.telInput.parentNode.cloneNode();
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
var flagsContainerClone = this.flagsContainer.cloneNode();
containerClone.appendChild(flagsContainerClone);
var selectedFlagClone = this.selectedFlag.cloneNode(true);
containerClone.appendChild(selectedFlagClone);
flagsContainerClone.appendChild(selectedFlagClone);
var width = selectedFlagClone.offsetWidth;
containerClone.parentNode.removeChild(containerClone);
return width;
Expand Down
2 changes: 1 addition & 1 deletion build/js/intlTelInput-jquery.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion build/js/intlTelInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,10 @@
var containerClone = this.telInput.parentNode.cloneNode();
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
var flagsContainerClone = this.flagsContainer.cloneNode();
containerClone.appendChild(flagsContainerClone);
var selectedFlagClone = this.selectedFlag.cloneNode(true);
containerClone.appendChild(selectedFlagClone);
flagsContainerClone.appendChild(selectedFlagClone);
var width = selectedFlagClone.offsetWidth;
containerClone.parentNode.removeChild(containerClone);
return width;
Expand Down
4 changes: 2 additions & 2 deletions build/js/intlTelInput.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/js/intlTelInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -1017,8 +1017,11 @@ class Iti {
containerClone.style.visibility = 'hidden';
document.body.appendChild(containerClone);

const flagsContainerClone = this.flagsContainer.cloneNode();
containerClone.appendChild(flagsContainerClone);

const selectedFlagClone = this.selectedFlag.cloneNode(true);
containerClone.appendChild(selectedFlagClone);
flagsContainerClone.appendChild(selectedFlagClone);

const width = selectedFlagClone.offsetWidth;
containerClone.parentNode.removeChild(containerClone);
Expand Down

0 comments on commit d9b15b6

Please sign in to comment.