I've been working on a web app with UI built using the Html Service. It's known that HtmlServices uses Caja Sanitization in pre-processing. As a result of this I see that id's of HTML elements are mangled, '-caja-guest-0___' is append to the original id.
I wonder 2 things:
1) What are best practices if I need to be able to get elements by their id's?
2) Can I rely that that suffix will always be '-caja-guest-0___'? Or is there a rule for it?
Thank a lot for all your responses.
You shouldn't rely on any specific things that Caja does because we are and will be making lots of improvements to Caja, which may change how things are implemented. I'd think of any Caja specific changes as private variables in a class you're using: don't rely on them to stay the same.
When working with element IDs, $("#elementId") should just work as expected in jQuery. I would recommend doing this.