Compute input size with an input element

This commit is contained in:
fabien.leconte 2016-09-26 12:32:16 +02:00
parent 239ae5e869
commit bf7fee1d91
4 changed files with 5 additions and 5 deletions

View file

@ -5057,7 +5057,7 @@
var width = input.offsetWidth;
if (value) {
var testEl = strToEl("<span>" + value + "</span>");
var testEl = strToEl("<input type=\"text\" value=\"" + value + "\">");
testEl.style.position = 'absolute';
testEl.style.padding = '0';
testEl.style.top = '-9999px';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -439,7 +439,7 @@ export const getWidthOfInput = (input) => {
let width = input.offsetWidth;
if (value) {
const testEl = strToEl(`<span>${ value }</span>`);
const testEl = strToEl(`<input type="text" value="${value}">`);
testEl.style.position = 'absolute';
testEl.style.padding = '0';
testEl.style.top = '-9999px';