File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,11 @@ if (pod2htmlForm) {
1414 const error = document . querySelector ( '#metacpan-pod-renderer-error' ) ;
1515 const template = document . querySelector ( '#metacpan-pod-renderer-content' ) ;
1616
17+ const parseHTML = ( html ) => {
18+ const template = document . createElement ( 'template' ) ;
19+ template . innerHTML = html ;
20+ return template . content ;
21+ } ;
1722 const updateHTML = async ( pod ) => {
1823 if ( ! pod ) {
1924 pod = textInput . value ;
@@ -47,8 +52,9 @@ if (pod2htmlForm) {
4752 document . title = "Pod Renderer - " + data . pod_title + " - metacpan.org" ;
4853
4954 const body = template . content . cloneNode ( true ) ;
50- body . querySelector ( '.toc-body' ) . outerHTML = data . pod_index ;
51- body . querySelector ( '.pod-body' ) . outerHTML = data . pod_html ;
55+ body . querySelector ( '.toc-body' ) . replaceWith ( parseHTML ( data . pod_index ) ) ;
56+ body . querySelector ( '.pod-body' ) . replaceWith ( parseHTML ( data . pod_html ) ) ;
57+
5258 rendered . replaceChildren ( body ) ;
5359
5460 formatTOC ( rendered . querySelector ( 'nav' ) ) ;
You can’t perform that action at this time.
0 commit comments