There's a special code in jQuery wrapper that prevents multiple instances of Formatter to be created which is good. The issue come when you seriously need to change pattern on the go. Typical example is credit cards one. Master Card, Visa and Discover all good with 4 groups of 4 digits. 16 total. American Express instead has 3 groups with 4, 6 and 5 digits. 15 total. Which card user types in you can get by first digit - it's 3 for Amex. Of course you can delay instantiation until user types first digit but what if he changes his mind later?
There's a special code in jQuery wrapper that prevents multiple instances of
Formatter
to be created which is good. The issue come when you seriously need to change pattern on the go. Typical example is credit cards one. Master Card, Visa and Discover all good with 4 groups of 4 digits. 16 total. American Express instead has 3 groups with 4, 6 and 5 digits. 15 total. Which card user types in you can get by first digit - it's3
for Amex. Of course you can delay instantiation until user types first digit but what if he changes his mind later?