Menu

#1580 javascript table innerText and textContent

Latest SVN
closed
RBRi
None
1
2014-03-05
2014-02-26
chris frost
No

I am using jquery 1.9.1 and with it I have a place that a table set textContent to an empty string. line 6505 tmp.textContent = ""; where tmp could be almost any type of element. HtmlUnit 2.14 throws an error while the browsers do not. My HtmlUnit is set to be IE11.

Using table element, I hunted the change to HTMLTableElement in ...javascipt.host.html package when setInnerTextImpl was added on 2013-12-23 at 19:02:45

To get a better idea, I did some checking with different browsers, and checked innerText, and textContent, even though I only care about textContent for my jquery error with HtmlUnit set as IE11.

Chrome 33 has both innerText and textContent, but will error if innerText is set. No error when textContent is set.

Firefox 27 only has textContent, allowing set and get. setting and getting innerText treats it as an extra property on the element initially undefined.

IE8 (though it may not matter) only has innerText, allowing set and get. treats textContent as an extra property, initially undefined. Weirdly does not allow setting innerHTML.

IE 10 and 11 has both and allows setting and getting from both innerText and textContent.

Discussion

  • RBRi

    RBRi - 2014-02-26
    • status: open --> accepted
    • assigned_to: RBRi
     
  • RBRi

    RBRi - 2014-02-27

    Hi Chris,

    wrote a small test that sets the textContent of a table tag. Works fine so far with the current code. Can you please have a look if you see the same result and report back.

    BTW: please keep in mind that the IE11 impl is not finished so far, we are still in the process of fixing the remaining issues.

     
  • RBRi

    RBRi - 2014-02-27
    • status: accepted --> pending
     
  • RBRi

    RBRi - 2014-02-27

    Hi Chris,

    wrote a small test that sets the textContent of a table tag. Works fine so far with the current code. Can you please have a look if you see the same result and report back.

    BTW: please keep in mind that the IE11 impl is not finished so far, we are still in the process of fixing the remaining issues.

     
  • chris frost

    chris frost - 2014-03-05

    Sorry for the delay. I do not have my current machine setup to build htmlunit, so I was waiting for a green build on CruiseControl. Since we had one last night, I tried the new version this morning. This problem is done. Working great.

    I understand that IE11 mode is a work in progress, as such I will likely find more IE11 stuff for ya in time. I tend to use firefox and chrome more manually, so I try to keep htmlunit on a version of IE, but just like with this issue, I will let you know what I see from all of the browsers.

    Thank you for the fix.

     
  • RBRi

    RBRi - 2014-03-05
    • status: pending --> closed
     
  • RBRi

    RBRi - 2014-03-05

    Thanks for reporting back.

     

Log in to post a comment.