null or undefined explicitly means append to the end according to the DOM api. Anything else is undefined behaviour, hence better to case tests both null and undefined. You could remove undefined and use the optional indicator though