I just realized that oldClasses could be undefined if the linkNode is a comment, that's why this is changed.