You may know this already, but the on* handlers have been deprecated and replaced with the <span style="font-weight: bold;">DOM 2 Events</span>* standard. So instead of doing 'onclick = "DoFunction()"' the programmer should be calling "
element.addEventListener('click', DoFunction, false)". If I understand you correctly, this effectively achieves your "no code in data" request. At least as far as the standards go.<br><br>For what it's worth, I'm not certain that keeping code and data separate fixes the security issues with XSS. For example, Fortify Software released a Javascript exploit that inlines JSON requests as a simple '<script src="/path/to/AJAX.json"></script>' tag, then captures the data present in the object created.
<br><br>You can read about the full exploit here:<br><br><a href="http://www.fortifysoftware.com/servlet/downloads/public/JavaScript_Hijacking.pdf">http://www.fortifysoftware.com/servlet/downloads/public/JavaScript_Hijacking.pdf
</a><br><br>Such problems go above and beyond the issues present in mixing code with data, and therefore require more sophisticated security models. <br><br>Thanks,<br>Jerason<br><br><span style="font-style: italic;">* Microsoft has yet to fully support the DOM 2 standard. As a result, IE does not support addEventListener. It does support "
element.attachEvent('onclick', DoFunction)" which effectively achieves the same goal. </span><br><br><div><span class="gmail_quote">On 6/7/07, <b class="gmail_sendername">Pieter Ceelen</b> <<a href="mailto:ceelen.p@gmail.com">
ceelen.p@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Thus instead of creating<br><br>index.html<br> <a href=# onclick="DoFunction()" id=123 >
<br><br>we write <br>index.html<br> <a href=# id=123 ><br><br>index.js<br> document.getElementById('123').onclick="DoFunction()"<span class="sg"><br>
</span></blockquote></div><br>