I am trying to write an Eclipse plugin that displays some information as an HTML page. For this, I want to use the SWT widget Browser. The problem is that when I install the contents of the browser using setText, the selectors nth-childdo not work, but when I install the same contents through setUrl("file://..., they work correctly. Why is the rendering different and how can I achieve the same rendering with setTextas well as with setUrl?
I create Browserwith SWT.NONE, since I do not want to force users to install Safari or Firefox.
This is HTML where the problem is reproducible:
<!doctype html><html><head>
<style type="text/css">
div:nth-child(2n) { background-color: #f00; }
</style>
</head><body>
<div>1</div>
<div>2</div>
<div>3</div>
</body></html>
source
share