var jsdom = require("jsdom").jsdom,
document = jsdom("");
t.textContent = "O HAI";
console.log(t.textContent); // nothing; should output "O HAI"
The last three lines in a browser will output "O HAI".
This is a tricky one. It looks like there's no textContent setter defined for text nodes, so it falls back a ways up the prototype chain to that for nodes. But Node's setter involves clearing out its children and adding a text node, which is obviously not the right thing to do.
There's also the related problem wherein text nodes seem to have a value property that's not really working correctly and also should not exist.
Interesting, this should be covered by the currently-passing nodesettextcontent07 test in test/level3/core.js. I wonder if it's only for disconnected text nodes?
Oh, great, level3/core tests are commented out and not running -_-
I am using jsdom 0.6.5 and I have the exact same issue trying to set the textContent property. Is this still an open issue? If so, is there a workaround?
This is still an open issue; I don't believe there is a workaround. I should really try to fix this some time soon... patches welcome, of course.
Fix textContent for nodes that do not have children