Micro Optimization

Extracted the `$(document)` to variable `$document`. It would not add much performance.