I don't think it is XC bug. I guess since it is smarty function always executes. I don't know.
What are you trying to do? Why use js? Can't you just use smarty function or modifier to get the value?