How do I create a documentFragment in GWT?
Creating a document fragment using plain Javascript is dead simple: var docFragment = document.createDocumentFragment();
.
Thanks.
Creating a JSNI method returning a DocumentFragment is dead simple.. you just return document.createDocumentFragment();
:) The JSNI method should either return JavaScriptObject
or some other type that you know will work (like Node
- I'm not sure were you are going with this, but JSOs work that way - you can cast<T>()
any subclass of JavaScriptObject
to any other JavaScriptObject
).
This particular question is addressed (with a workaround similar to Klimer's suggestion) in "Issue 2955: Not able to create a document fragment object for dom" on GWT's issue tracker.
You could also contribute to this ticket and "star" the issue to show your interest in seeing this added to the GWT framework.
精彩评论