Improve modal performance & refactor var names. Bug 902697.
Merge pull request #1142 from jpetto/bug-902697-mozilla-modal-js-refactor

Improve performance & fix .contains bug. Bug 902697.