MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / simplifyHtmlElement

Function simplifyHtmlElement

lib/html.js:295–306  ·  view source on GitHub ↗
(html, maxLength = 300)

Source from the content-addressed store, hash-verified

293}
294
295function simplifyHtmlElement(html, maxLength = 300) {
296 try {
297 html = removeNonInteractiveElements(html)
298 html = html.replace(/<html>(?:<head>.*?<\/head>)?<body>(.*)<\/body><\/html>/s, '$1').trim()
299 } catch (e) {
300 // keep raw html if minification fails
301 }
302 if (html.length > maxLength) {
303 html = html.slice(0, maxLength) + '...'
304 }
305 return html
306}
307
308async function formatHtml(html) {
309 let processed = html

Callers 1

toSimplifiedHTMLMethod · 0.90

Calls 1

Tested by

no test coverage detected