#6175: Refactor code
Merge pull request #6192 from dotCMS/issue-6175-js-error

#6175: Refactor code