igorescobar/jQuery-Mask-Plugin — pull request #249 by natematykiewicz (2014-12-12 18:09:04+00:00)
Title: Needed to manually apply "data-mask" masks

I use the UJS attributes. By default, the code masks all "data-mask" elements, but there's no function I can call to apply ones that were added to the DOM later (best I could do was calling .mask() on each one with the data-mask attributes). Now, I can call `$.applyMasksFromHTML();` after adding elements to the DOM, and they get applied.

I didn't like the idea of using the watcher because I know when they're being added, and could easily call it once and be done with it, which is why I added this.

I also noticed that the code that applies the initial data-mask masks uses ALL *[data-mask] fields, while the code that runs in the watcher only affects maskElements ('input,td,span,div'). That seemed inconsistent, so I made them both use this function which only affects maskElements.