You could just memoize `document` and make it a function call. That way you'd remove the requirement to pass anything in. Esp, considering this is a protected or possibly even private method.