GWT用RootPanel替换div(不附加!)
如果在GWT中执行RootPanel.get("someDiv").add(myPanel);
,我总是得到:
<div id="someDiv"><div></div></div>
In GWT if I do RootPanel.get("someDiv").add(myPanel);
I invariably get:
<div id="someDiv"><div></div></div>
但是,我只想要1个层次结构,即<div id="someDiv"><div>
,其中someDiv包含myPanel.
But, I just want 1 level of hierarchy, i.e., <div id="someDiv"><div>
where the someDiv contains myPanel.
有什么想法吗? 谢谢!
Any ideas? Thanks!
面板必须是div(或表或跨度).您的RootPanel是一个div,您添加到其中的面板是一个div.
A Panel has to be a div (or table or span). Your RootPanel is a div, and the Panel you add to it is a div.
如果您要编写一个整页应用程序,则RootPanel.get()返回该元素,因此向其添加div将仅导致
If you're writing a full-page app, RootPanel.get() returns the element, so adding a div to that will only result in one div inside the
但是说实话,尝试摆脱应用程序中的div嵌套并不会节省您任何明显的时间.
But honestly, trying to get rid of one nesting of divs in your application is not going to save you any noticeable amount of time.