Skip to content

textContent setter doesn't #483

Closed
wmertens opened this Issue Aug 23, 2012 · 6 comments

3 participants

@wmertens

To reproduce:

var jsdom = require("jsdom").jsdom,
    document = jsdom("");
t=document.createTextNode("");
t.textContent = "O HAI";
console.log(t.textContent); // nothing; should output "O HAI"

The last three lines in a browser will output "O HAI".

@domenic
Collaborator
domenic commented Oct 5, 2012

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.

@domenic
Collaborator
domenic commented Oct 5, 2012

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.

@domenic
Collaborator
domenic commented Oct 5, 2012

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?

@domenic
Collaborator
domenic commented Oct 5, 2012

Oh, great, level3/core tests are commented out and not running -_-

@aldohb
aldohb commented Jul 9, 2013

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?

@domenic
Collaborator
domenic commented Jul 15, 2013

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.

@domenic domenic closed this in cdd79dc Jun 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.