jcouyang / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

setTextContent on a textnode that has not yet beeing appended to the dom in ie7 #553

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. Browser is ie7
2. var x = goog.dom.createTextNode('asdf');
3. goog.dom.setTextContent(x, 'qwer');

What is the expected output? What do you see instead?
Error : "Unexpected call to method or property access." 

What version of the product are you using? On what operating system?
Internet Explorer 7

Please provide any additional information below.
Can be fixed by changing these lines in goog.dom.setTextContent

else {
    goog.dom.removeChildren(element);
    var doc = goog.dom.getOwnerDocument(element);
    element.appendChild(doc.createTextNode(text));
  }

to

else {
    element.data = text;
  }

Original issue reported on code.google.com by to.ljung...@gmail.com on 22 Apr 2013 at 2:33

GoogleCodeExporter commented 9 years ago
x in your example is a TextNode. goog.dom.setTextContent expects an Element.

Original comment by nn...@google.com on 22 Apr 2013 at 2:58