I want to implement Auto Compete in lightning, for this I have to use jQuery and jQueryUI and I have to directly modify DOM of component as well. Will it be allowed by the Salesforce ? Will is cause any issue during security review ?
1 Answer
It will cause an issue during security review if you:
- Modify DOM from your component outside a Renderer:
The only modification allowed on Controllers are add/remove/toggle classes using $A.util methods. Keep in mind that DOM is ReadOnly outside a Renderer.
- Modify DOM from another component
You can read the DOM of another component only if it's a child component, this is why all your selectors should be scoped within the component.
- Events are handled by 3rd party libs
You can add/remove event listeners when rendering the component, in our case we add event listeners in the afterRender event using a function built with aura framework, and then remove the listener in the unrender event. If your 3rd party library add/remove events then it has a high change to fail Security Review.
- Fire events from a Renderer
You can add/remove event listeners in a renderer but never fire them from a renderer.
You can find more rules here:
https://developer.salesforce.com/page/Requirements_Checklist https://developer.salesforce.com/page/Lightning_Security
Having said that I strongly suggest to use only Lightning Components and Javascript, my team did this in order to pass security review. We used some Autocomplete examples from Salesforce Dev portal and other sites and all failed to pass Security Review because of the rules above.
Note: If there's anything wrong/inaccurate with this answer/recommendation, please write a comment so I can make it better next time ;)