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

RBRi via HtmlUnit-develop <[email protected]> Thu, 18 Oct 2018 06:48:53 -0000
Newsgroups gmane.comp.java.htmlunit.devel
Message-ID </p/htmlunit/bugs/1993/7bda863072aa5133a142bf87011fbb6415d4320d.bugs@htmlunit.p.sourceforge.net>
I guess you second case is not related to the innerHtml call. If yes please open a new issue for this.


---

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

**Status:** accepted
**Group:** 2.33
**Labels:** javascript 
**Created:** Tue Oct 16, 2018 02:44 AM UTC by Rural Hunter
**Last Updated:** Thu Oct 18, 2018 06:47 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