Bug 1084298 - [Messages] Decoupling the all inputs query logic from DOM tree structure

- Add map for each view for maintaining the data for rendering/selection
Thanks! I also thought of the `for of` loop at first, but I choose normal `while` loop because of performance concern. After some testing the they didn't have much difference actually, so I'll apply your suggestion, thanks!