mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-27 01:40:26 +02:00
Compute input size with an input element
This commit is contained in:
parent
239ae5e869
commit
bf7fee1d91
2
assets/scripts/dist/choices.js
vendored
2
assets/scripts/dist/choices.js
vendored
|
@ -5057,7 +5057,7 @@
|
||||||
var width = input.offsetWidth;
|
var width = input.offsetWidth;
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
var testEl = strToEl("<span>" + value + "</span>");
|
var testEl = strToEl("<input type=\"text\" value=\"" + value + "\">");
|
||||||
testEl.style.position = 'absolute';
|
testEl.style.position = 'absolute';
|
||||||
testEl.style.padding = '0';
|
testEl.style.padding = '0';
|
||||||
testEl.style.top = '-9999px';
|
testEl.style.top = '-9999px';
|
||||||
|
|
2
assets/scripts/dist/choices.js.map
vendored
2
assets/scripts/dist/choices.js.map
vendored
File diff suppressed because one or more lines are too long
4
assets/scripts/dist/choices.min.js
vendored
4
assets/scripts/dist/choices.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -439,7 +439,7 @@ export const getWidthOfInput = (input) => {
|
||||||
let width = input.offsetWidth;
|
let width = input.offsetWidth;
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
const testEl = strToEl(`<span>${ value }</span>`);
|
const testEl = strToEl(`<input type="text" value="${value}">`);
|
||||||
testEl.style.position = 'absolute';
|
testEl.style.position = 'absolute';
|
||||||
testEl.style.padding = '0';
|
testEl.style.padding = '0';
|
||||||
testEl.style.top = '-9999px';
|
testEl.style.top = '-9999px';
|
||||||
|
|
Loading…
Reference in a new issue