selectize.js
selectize.js copied to clipboard
fix: ensure the parent of $testInput exists within the body
In some scenarios of using SPA, measureString can correctly calculate the width of $testInput on the first call. However, due to various possibilities, changes to the DOM will cause $testInput to leave the body, and the calculation result of measureString will always be 0. This PR ensures that $testInput always exists under the body to calculate the correct width.
The following is a rough example of reproducing the bug:
// Append $testInput to the body
$("input").appendTo("body").selectize();
// $testInput leaves the body
$("body").html("");
// measureString gets incorrect results
$("input").appendTo("body").selectize();
This pull request is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days
@risadams can help review this PR?
This pull request is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days