Update Prototype-getPath.js

added getPathFromId and handling cases where element is undefined