cdata-iframe.xhtml (859B)
1 <?xml version="1.0"?> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <body> 4 <div id="container"></div> 5 </body> 6 7 <script> 8 function createXHTMLCase(id) { 9 const container = document.getElementById("container"); 10 11 const div = document.createElement("div"); 12 div.dir = "auto"; 13 div.id = id; 14 15 const cdata = document.createCDATASection("foo"); 16 const text = document.createTextNode("اختبر"); 17 div.appendChild(cdata); 18 div.appendChild(text); 19 20 container.appendChild(div); 21 22 return [div, cdata]; 23 } 24 25 window.addEventListener("message", (e) => { 26 createXHTMLCase(e.data); 27 window.top.postMessage(e.data); 28 }); 29 30 window.top.postMessage("subframe-loaded"); 31 </script> 32 </html>