Have fun =) Here's your answer:

There is no "first class support" for createTextNode (ie. a managed API that 
calls directly into the browser's native code). However, any javascript 
function can be called from managed code with "Invoke" so you could do this:

newtext = HtmlPage.Document.Invoke("createTextNode", "Some text added 
dynamically")
HtmlPage.Document.p1.Invoke("appendChild", newtext)

The "appendChild" call needs to be invoked as well, since the managed 
"AppendChild" equivalent only takes a HtmlElement, and Invoke will return a 
ScriptObject, and you can't cast a ScriptObject to a HtmlElement.

~js

________________________________________
From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Jonathan Slenders [EMAIL 
PROTECTED]
Sent: Monday, July 14, 2008 10:36 PM
To: Discussion of IronPython
Subject: Re: [IronPython] XmlDocument or XDocument in Python/Silverlight

Thank you, Jimmy.

At the moment, I'm at a summercamp and stay there until the end of the month. 
Therefore, I've been inactive at this newsgroup.

Jonathan

2008/7/15 Jimmy Schementi <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>:
Jonathan Slenders wrote:
>
> And another question, which is rather Silverlight then IronPython
> related. I hope it's okey to ask it here.
> How should I create a TextNode from Silverlight with IronPython code?
> In javascript, one would:
>
> node = document.createTextNode("text"); element.appendChild(node);
>
> According to the MSDN documentation, the HtmlDocument class doesn't
> have a createTextNode, and I can't find it anywhere else. Michael his
> book has been extremely useful for me, but he uses innerHtml which i
> really don't like. InnerHtml is is an old-style method for DOM-
> manipulation, and unsafe by definition. (it allows you to insert HTML
> code)

Did you figure this out yet? Actually, not sure of the answer, but I "think" 
Silverlight doesn't support this. But it should. I sent a mail off to the 
Silverlight guys who work on the HTML bridge a while ago. I'll check back with 
them again, and get back to you.

~Jimmy
_______________________________________________
Users mailing list
Users@lists.ironpython.com<mailto:Users@lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to