Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

What is the limit to DOM manipulation

trangdan106
Tera Contributor

Hello everyone, 

I know that DOM manipulation is a highly discourage way to try and manipulate the DOM as future release may and can break the DOM process as it replace the DOM instead of adding on.

However, I notice that there are some class that are custom such as <sn-search-genius-card-assist>. I'm wondering are they safe from the bad effects of DOM manipulation? How much of the limit I can push? Or, are they more susceptible to be replaced by DOM as they are customer class from ServiceNow?

 

Thank you all.

3 REPLIES 3

Aditya_hublikar
Giga Sage

Hello @trangdan106 ,

 

As per my understanding there isn't a specific ServiceNow-defined "limit" such as "you can manipulate 5 DOM elements but not 10." The limit is really about how tightly your code depends on ServiceNow's rendered HTML.

 But it also recommends avoiding DOM manipulation where possible because of maintainability and upgrade risk.

Refer this :

https://www.servicenow.com/docs/r/platform-user-interface/service-portal/widget-dev-guide.html?conte... 

Hi, thank you for the link, it was really helpful but would custom SNOW elements such as <sn-search-genius-card-assist> be less affected by changes made when ServiceNow upgrades?

Ankur Bawiskar
Tera Patron

@trangdan106 

there are some requirements which you can't do without DOM manipulation

if customer wants that requirement, you need to do that and inform the impact of DOM manipulation

No limit as such it all depends on customer requirement and the script you are using

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader