Unwrap Document/Node when passing to native functions