Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: _getHiddenSelectedCountryWidth document.body access #1934

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/js/intlTelInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2747,13 +2747,13 @@ var factoryOutput = (() => {
if (this.telInput.parentNode) {
const containerClone = this.telInput.parentNode.cloneNode(false);
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
window.top.document.body.appendChild(containerClone);
const countryContainerClone = this.countryContainer.cloneNode();
containerClone.appendChild(countryContainerClone);
const selectedCountryClone = this.selectedCountry.cloneNode(true);
countryContainerClone.appendChild(selectedCountryClone);
const width = selectedCountryClone.offsetWidth;
document.body.removeChild(containerClone);
window.top.document.body.removeChild(containerClone);
return width;
}
return 0;
Expand Down
2 changes: 1 addition & 1 deletion build/js/intlTelInput.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/js/intlTelInputWithUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2746,13 +2746,13 @@ var factoryOutput = (() => {
if (this.telInput.parentNode) {
const containerClone = this.telInput.parentNode.cloneNode(false);
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
window.top.document.body.appendChild(containerClone);
const countryContainerClone = this.countryContainer.cloneNode();
containerClone.appendChild(countryContainerClone);
const selectedCountryClone = this.selectedCountry.cloneNode(true);
countryContainerClone.appendChild(selectedCountryClone);
const width = selectedCountryClone.offsetWidth;
document.body.removeChild(containerClone);
window.top.document.body.removeChild(containerClone);
return width;
}
return 0;
Expand Down
2 changes: 1 addition & 1 deletion build/js/intlTelInputWithUtils.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions react/build/IntlTelInput.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2742,13 +2742,13 @@ var Iti = class {
if (this.telInput.parentNode) {
const containerClone = this.telInput.parentNode.cloneNode(false);
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
window.top.document.body.appendChild(containerClone);
const countryContainerClone = this.countryContainer.cloneNode();
containerClone.appendChild(countryContainerClone);
const selectedCountryClone = this.selectedCountry.cloneNode(true);
countryContainerClone.appendChild(selectedCountryClone);
const width = selectedCountryClone.offsetWidth;
document.body.removeChild(containerClone);
window.top.document.body.removeChild(containerClone);
return width;
}
return 0;
Expand Down
4 changes: 2 additions & 2 deletions react/build/IntlTelInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2706,13 +2706,13 @@ var Iti = class {
if (this.telInput.parentNode) {
const containerClone = this.telInput.parentNode.cloneNode(false);
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
window.top.document.body.appendChild(containerClone);
const countryContainerClone = this.countryContainer.cloneNode();
containerClone.appendChild(countryContainerClone);
const selectedCountryClone = this.selectedCountry.cloneNode(true);
countryContainerClone.appendChild(selectedCountryClone);
const width = selectedCountryClone.offsetWidth;
document.body.removeChild(containerClone);
window.top.document.body.removeChild(containerClone);
return width;
}
return 0;
Expand Down
4 changes: 2 additions & 2 deletions react/build/IntlTelInputWithUtils.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2742,13 +2742,13 @@ var Iti = class {
if (this.telInput.parentNode) {
const containerClone = this.telInput.parentNode.cloneNode(false);
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
window.top.document.body.appendChild(containerClone);
const countryContainerClone = this.countryContainer.cloneNode();
containerClone.appendChild(countryContainerClone);
const selectedCountryClone = this.selectedCountry.cloneNode(true);
countryContainerClone.appendChild(selectedCountryClone);
const width = selectedCountryClone.offsetWidth;
document.body.removeChild(containerClone);
window.top.document.body.removeChild(containerClone);
return width;
}
return 0;
Expand Down
4 changes: 2 additions & 2 deletions react/build/IntlTelInputWithUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2706,13 +2706,13 @@ var Iti = class {
if (this.telInput.parentNode) {
const containerClone = this.telInput.parentNode.cloneNode(false);
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
window.top.document.body.appendChild(containerClone);
const countryContainerClone = this.countryContainer.cloneNode();
containerClone.appendChild(countryContainerClone);
const selectedCountryClone = this.selectedCountry.cloneNode(true);
countryContainerClone.appendChild(selectedCountryClone);
const width = selectedCountryClone.offsetWidth;
document.body.removeChild(containerClone);
window.top.document.body.removeChild(containerClone);
return width;
}
return 0;
Expand Down
4 changes: 2 additions & 2 deletions react/demo/set-number/set-number-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26293,13 +26293,13 @@
if (this.telInput.parentNode) {
const containerClone = this.telInput.parentNode.cloneNode(false);
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
window.top.document.body.appendChild(containerClone);
const countryContainerClone = this.countryContainer.cloneNode();
containerClone.appendChild(countryContainerClone);
const selectedCountryClone = this.selectedCountry.cloneNode(true);
countryContainerClone.appendChild(selectedCountryClone);
const width = selectedCountryClone.offsetWidth;
document.body.removeChild(containerClone);
window.top.document.body.removeChild(containerClone);
return width;
}
return 0;
Expand Down
4 changes: 2 additions & 2 deletions react/demo/simple/simple-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26293,13 +26293,13 @@
if (this.telInput.parentNode) {
const containerClone = this.telInput.parentNode.cloneNode(false);
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
window.top.document.body.appendChild(containerClone);
const countryContainerClone = this.countryContainer.cloneNode();
containerClone.appendChild(countryContainerClone);
const selectedCountryClone = this.selectedCountry.cloneNode(true);
countryContainerClone.appendChild(selectedCountryClone);
const width = selectedCountryClone.offsetWidth;
document.body.removeChild(containerClone);
window.top.document.body.removeChild(containerClone);
return width;
}
return 0;
Expand Down
4 changes: 2 additions & 2 deletions react/demo/toggle-disabled/toggle-disabled-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26293,13 +26293,13 @@
if (this.telInput.parentNode) {
const containerClone = this.telInput.parentNode.cloneNode(false);
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
window.top.document.body.appendChild(containerClone);
const countryContainerClone = this.countryContainer.cloneNode();
containerClone.appendChild(countryContainerClone);
const selectedCountryClone = this.selectedCountry.cloneNode(true);
countryContainerClone.appendChild(selectedCountryClone);
const width = selectedCountryClone.offsetWidth;
document.body.removeChild(containerClone);
window.top.document.body.removeChild(containerClone);
return width;
}
return 0;
Expand Down
4 changes: 2 additions & 2 deletions react/demo/validation/validation-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26293,13 +26293,13 @@
if (this.telInput.parentNode) {
const containerClone = this.telInput.parentNode.cloneNode(false);
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
window.top.document.body.appendChild(containerClone);
const countryContainerClone = this.countryContainer.cloneNode();
containerClone.appendChild(countryContainerClone);
const selectedCountryClone = this.selectedCountry.cloneNode(true);
countryContainerClone.appendChild(selectedCountryClone);
const width = selectedCountryClone.offsetWidth;
document.body.removeChild(containerClone);
window.top.document.body.removeChild(containerClone);
return width;
}
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/js/intl-tel-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ export class Iti {
if (this.telInput.parentNode) {
const containerClone = this.telInput.parentNode.cloneNode(false) as HTMLElement;
containerClone.style.visibility = "hidden";
document.body.appendChild(containerClone);
window.top.document.body.appendChild(containerClone);

const countryContainerClone = this.countryContainer.cloneNode() as HTMLElement;
containerClone.appendChild(countryContainerClone);
Expand All @@ -1658,7 +1658,7 @@ export class Iti {
countryContainerClone.appendChild(selectedCountryClone);

const width = selectedCountryClone.offsetWidth;
document.body.removeChild(containerClone);
window.top.document.body.removeChild(containerClone);
return width;
}
return 0;
Expand Down
4 changes: 2 additions & 2 deletions vue/build/IntlTelInput.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2253,13 +2253,13 @@ class G {
_getHiddenSelectedCountryWidth() {
if (this.telInput.parentNode) {
const t = this.telInput.parentNode.cloneNode(!1);
t.style.visibility = "hidden", document.body.appendChild(t);
t.style.visibility = "hidden", window.top.document.body.appendChild(t);
const e = this.countryContainer.cloneNode();
t.appendChild(e);
const i = this.selectedCountry.cloneNode(!0);
e.appendChild(i);
const s = i.offsetWidth;
return document.body.removeChild(t), s;
return window.top.document.body.removeChild(t), s;
}
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions vue/build/IntlTelInputWithUtils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2253,13 +2253,13 @@ class K2 {
_getHiddenSelectedCountryWidth() {
if (this.telInput.parentNode) {
const e = this.telInput.parentNode.cloneNode(!1);
e.style.visibility = "hidden", document.body.appendChild(e);
e.style.visibility = "hidden", window.top.document.body.appendChild(e);
const n = this.countryContainer.cloneNode();
e.appendChild(n);
const s = this.selectedCountry.cloneNode(!0);
n.appendChild(s);
const o = s.offsetWidth;
return document.body.removeChild(e), o;
return window.top.document.body.removeChild(e), o;
}
return 0;
}
Expand Down