RobinHerbots/Inputmask

Inputmask ignores changes to the placeholder when resetting it.

chriscpty opened this issue · 0 comments

On the mouseout event, inputmask resets the input's placeholder to whatever placeholder it had when inputmask was first initialised.
If the placeholder on the input was changed afterwards, the new placeholder gets lost.

Minimum reproducible example:

<!DOCTYPE HTML>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="jquery.inputmask.js"></script>
</head>
<body>
<input type="text" id="inputmask_example" placeholder="old placeholder" />
<script>
$('#inputmask_example').inputmask("99-999999");
$('#inputmask_example').attr('placeholder', 'new placeholder');
</script>
</body>
</html>

When hovering and then leaving the text input, its placeholder is set back to "old placeholder".

Expected behaviour (IMO) would be that if the input's placeholder is changed by something other than inputmask, inputmask should remember that placeholder as the placeholder to reset to (from taking a short look at the code, i believe that'd be in the originalPlaceholder attribute of the inputmask object).

Alternatively, there should be an option to manually set the originalPlaceholder to avoid this issue.

Inputmask version: I could reproduce this on both 5.0.9 and 5.0.10-beta.8
OS: Windows 10
Browser: I could reproduce this on both Firefox and Chrome