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: ensure the parent of $testInput exists within the body #2000

Closed
wants to merge 1 commit into from

Conversation

yfxie
Copy link

@yfxie yfxie commented Apr 12, 2023

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(); 

@github-actions
Copy link
Contributor

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

@yfxie
Copy link
Author

yfxie commented Aug 18, 2023

@risadams can help review this PR?

Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant