yuntaozhu / closure-library

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

DomHelper fails to create TextNodes containing numbers #594

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run the attached test case
2. goog.dom.getDomHelper().createDom('input', {type: 'text'}, "1");
3. assertEquals("1", element.innerHTML);

What is the expected output? What do you see instead?

Expected element.innerHTML to be the string "1", but it's an empty string 
instead.

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

Latest Closure Library from git.

Please provide any additional information below.

function test_domhelper_append()
{
    var dom = goog.dom.getDomHelper();
    var element = dom.createDom('input', {
        'type': 'text',
    }, "1");
    assertEquals("1", element.innerHTML);
};

Note: we cannot accept patches without the contributor license agreement
being signed. See http://code.google.com/p/closure-
library/wiki/Contributors for more info.

Original issue reported on code.google.com by wil...@gmail.com on 20 Sep 2013 at 5:12

GoogleCodeExporter commented 8 years ago
This is an issue of the browser not giving the innerHTML you'd expect. This 
works fine if you use goog.dom.getTextContent()

function testDomHelperAppend(){
  var dom = goog.dom.getDomHelper();
  var element = dom.createDom('input', {
    'type': 'text'
  }, "1");
  assertEquals("1", goog.dom.getTextContent(element));
};

Original comment by nn...@google.com on 20 Sep 2013 at 5:45