add g.type test ,cases from jQuery