[HtmlUnit] [htmlunit:bugs] #1993 Javascript: DIV.innerHTML adding operation bug

RBRi via HtmlUnit-develop <[email protected]> Wed, 17 Oct 2018 17:46:18 -0000
Newsgroups gmane.comp.java.htmlunit.devel
Message-ID </p/htmlunit/bugs/1993/2c74e0cbec6115cdfe5fbc1613849874bda01936.bugs@htmlunit.p.sourceforge.net>
- **status**: open --> closed
- **Comment**:

Have added the cache cleanup and a unit test.

Thanks for reporting.



---

** [bugs:#1993] Javascript: DIV.innerHTML adding operation bug**

**Status:** closed
**Group:** 2.33
**Labels:** javascript 
**Created:** Tue Oct 16, 2018 02:44 AM UTC by Rural Hunter
**Last Updated:** Tue Oct 16, 2018 09:48 AM UTC
**Owner:** RBRi


In real browser, when I add the inner html of one div A to another div B, the height of B is also added by the height of A. But in htmlunit, it doesn't. The test code to reproduce:
~~~
    public static void testDivAdd() throws Exception
    {
        List<String> alerts = new ArrayList<>();
        WebClient wc=new WebClient();
        wc.setAlertHandler(new CollectingAlertHandler(alerts));
        wc.getPage(HtmlUnitTest.class.getResource("divadd.html"));
        System.out.println(alerts.toString());
    }
~~~
The content of the divadd.html:
~~~
<html>
<head>
    <title>test</title>
</head>

<body>
<div id="div1" style="height: 18px">
    aaa<br/>
</div>
<div id="templayer" ></div>

<script language="JavaScript">
function init(){ 
    templayer.innerHTML=""; 
    alert("before "+templayer.offsetHeight);
    templayer.innerHTML+=div1.innerHTML; 
    alert("after "+templayer.offsetHeight);
}
document.body.onload=init;
</script>
</body>
</html>
~~~


---

Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/htmlunit/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.

_______________________________________________
HtmlUnit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop