Node.textContent, as defined by the W3C at
http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent
and by Mozilla at https://developer.mozilla.org/En/DOM/Node.textContent
seems to be unsupported in cajoled code, even though it's commonly
used as a safe way to set (and retrieve) the textual content of a
node. A proof-of-concept follows.

<div id="test">never set; neither textContent nor innerHTML worked</
div>
<script type="text/javascript">
    var testDiv = document.getElementById('test');
    testDiv.innerHTML = 'set using innerHTML, but textContent does not
work';
    testDiv.innerHTML += testDiv.textContent ? '' : '; in fact the
textContent property is unreadable';
    testDiv.textContent = 'setting textContent works' +
(testDiv.textContent ? '; so does reading textContent' : '');
</script>

Reply via email to