Is `context` here OK? Is it guaranteed to be a `document`?