I'm working with some CMS system, and I have to paste HTML code (including CSS and JavaScript) in an editor.
The problem is it parses the input to validate html code. I have this piece of problematic code
keys.sort(function(a,b) {
if (a.position > b.position) return 1;
if (a.position < b.position) return -1;
return 0;
});
While it is valid JS syntax, the parser sees the <
and >
and says that is invalid syntax for html tags.
I'm wondering if JavaScript has another way to check for greater than or less than that doesn't use those <|>
symbols. Does anyone know?