On Wednesday, March 5, 2014 7:56:45 PM UTC+1, Jens wrote:
>
> It seems that the existing svg element is not recognized by the Snap 
>> constructor.
>> This was also noticed 
>> here<http://stackoverflow.com/questions/20045532/snap-svg-cant-find-dynamically-and-successfully-appended-svg-element-with-jqu>,
>>  
>> but the solution (adding more attributes to the element) did not make a 
>> change.
>>
>
> Oh I see.. didn't know the namespace thing. Well then either do what the 
> solution on Stackoverflow suggests (I think GWT has not build-in 
> createElementNS() method so you would create it in a custom JSNI method)
>

I tried this (because of the suggestion):

  Element  e = Document.get().createElement("svg");
  e.setAttribute ("width","400");
  e.setAttribute ("height","400");
  e.setAttribute ("xmlns","http://www.w3.org/2000/svg";);
  e.setAttribute ("version","1.1");
  setElement(e);

 
But the svg element wasn't recognized by Snap.

or use a <div> for your widget and let Snap create the SVG element (and 
> then append it to your widget's <div>)
>

This is what I would prefer:

private native void testLib (Element container)
 /*-{
  var s = $wnd.Snap (400,400);
  var c = s.circle (150,150,100);  
  container.appendChild (s);
 }-*/;

But this leads to:

                "An attempt was made to reference a Node in a context where 
it does not exist."

Magnus 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to