//public void __adoptNode(__XNode e) //{ // if (e.InternalValue.ownerDocument == this.InternalValue.ownerDocument) // return; // // is ie too helpful // // and returns html document from a xmlhttprequest? // #region we need this workaround to bring html alive // if (Expando.InternalIsMember(this.InternalValue, "innerHTML")) // if (!Expando.InternalIsMember(e.InternalValue, "innerHTML")) // { // // adding XElement into HTML aren't we? // var swap = new IHTMLDiv(); // // will this trigger scripts? // //swap.innerHTML = e.ToString(); // swap.innerHTML = IXMLDocument.ToXMLString(e.InternalValue); // e.InternalValue = swap.firstChild; // return; // } // #endregion //} internal static void InternalRebuildDocument(__XNode that, __XElement IncomingXElement) { if (IncomingXElement.InternalValue.ownerDocument == that.InternalValue.ownerDocument) { return; } // due to IE! //Console.WriteLine(" ok, force import manually. swap documents"); var IncomingXElementAttributes = IncomingXElement.Attributes().Select(a => new { a.Name, a.Value }).ToArray(); var IncomingXElementNodes = IncomingXElement.Nodes().ToArray(); // first reset the underlying node IncomingXElement.InternalValue = that.InternalValue.ownerDocument.createElement( IncomingXElement.InternalValue.nodeName ); foreach (var item in IncomingXElementAttributes) { IncomingXElement.Add( new XAttribute(item.Name, item.Value) ); } IncomingXElement.Add(IncomingXElementNodes); //Console.WriteLine(" ok, force import manually done!"); }
//public void __adoptNode(__XNode e) //{ // if (e.InternalValue.ownerDocument == this.InternalValue.ownerDocument) // return; // // is ie too helpful // // and returns html document from a xmlhttprequest? // #region we need this workaround to bring html alive // if (Expando.InternalIsMember(this.InternalValue, "innerHTML")) // if (!Expando.InternalIsMember(e.InternalValue, "innerHTML")) // { // // adding XElement into HTML aren't we? // var swap = new IHTMLDiv(); // // will this trigger scripts? // //swap.innerHTML = e.ToString(); // swap.innerHTML = IXMLDocument.ToXMLString(e.InternalValue); // e.InternalValue = swap.firstChild; // return; // } // #endregion //} public static void InternalRebuildDocument(__XNode that, __XElement IncomingXElement) { //Z:\jsc.svn\examples\javascript\test\TestIEXElement\Application.cs // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201511/20151123/uploadvaluestaskasync IncomingXElement.InternalValueInitialize(); that.InternalValueInitialize(); var sameDocument = IncomingXElement.InternalValue.ownerDocument == that.InternalValue.ownerDocument; //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { sameDocument }); //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { that }); // view-source:55048 44ms enter __XNode InternalRebuildDocument { IncomingXElementNode = bar } // IncomingXElement cant be bar?? //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { IncomingXElement, GetType = IncomingXElement.GetType() }); if (sameDocument) { return; } // due to IE! //Console.WriteLine(" ok, force import manually. swap documents"); //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { IncomingXElement.InternalValue.text }); //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { IncomingXElement.InternalValue.firstChild, IncomingXElement.InternalValue.text }); var IncomingXElementAttributes = IncomingXElement.Attributes().Select(a => new { a.Name, a.Value }).ToArray(); var IncomingXElementNodes = IncomingXElement.Nodes().ToArray(); foreach (var IncomingXElementNode in IncomingXElementNodes) { // howcom here we get to know its bar but not before? var IncomingXElementNodeAsXText = IncomingXElementNode as XText; if (IncomingXElementNodeAsXText != null) { //Console.WriteLine("enter __XNode IncomingXElementNodeAsXText " + new { IncomingXElementNodeAsXText }); //Console.WriteLine("enter __XNode IncomingXElementNodeAsXText " + new { IncomingXElementNodeAsXText.Value }); } else { //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { IncomingXElementNode }); } } // first reset the underlying node IncomingXElement.InternalValue = that.InternalValue.ownerDocument.createElement( IncomingXElement.InternalValue.nodeName ); foreach (var item in IncomingXElementAttributes) { IncomingXElement.Add( new XAttribute(item.Name, item.Value) ); } //Console.WriteLine("enter __XNode InternalRebuildDocument Add " + new { IncomingXElementNodes.Length }); IncomingXElement.Add(IncomingXElementNodes); //Console.WriteLine(" ok, force import manually done!"); }
//public void __adoptNode(__XNode e) //{ // if (e.InternalValue.ownerDocument == this.InternalValue.ownerDocument) // return; // // is ie too helpful // // and returns html document from a xmlhttprequest? // #region we need this workaround to bring html alive // if (Expando.InternalIsMember(this.InternalValue, "innerHTML")) // if (!Expando.InternalIsMember(e.InternalValue, "innerHTML")) // { // // adding XElement into HTML aren't we? // var swap = new IHTMLDiv(); // // will this trigger scripts? // //swap.innerHTML = e.ToString(); // swap.innerHTML = IXMLDocument.ToXMLString(e.InternalValue); // e.InternalValue = swap.firstChild; // return; // } // #endregion //} public static void InternalRebuildDocument(__XNode that, __XElement IncomingXElement) { //Z:\jsc.svn\examples\javascript\test\TestIEXElement\Application.cs // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201511/20151123/uploadvaluestaskasync IncomingXElement.InternalValueInitialize(); that.InternalValueInitialize(); var sameDocument = IncomingXElement.InternalValue.ownerDocument == that.InternalValue.ownerDocument; //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { sameDocument }); //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { that }); // view-source:55048 44ms enter __XNode InternalRebuildDocument { IncomingXElementNode = bar } // IncomingXElement cant be bar?? //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { IncomingXElement, GetType = IncomingXElement.GetType() }); if (sameDocument) return; // due to IE! //Console.WriteLine(" ok, force import manually. swap documents"); //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { IncomingXElement.InternalValue.text }); //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { IncomingXElement.InternalValue.firstChild, IncomingXElement.InternalValue.text }); var IncomingXElementAttributes = IncomingXElement.Attributes().Select(a => new { a.Name, a.Value }).ToArray(); var IncomingXElementNodes = IncomingXElement.Nodes().ToArray(); foreach (var IncomingXElementNode in IncomingXElementNodes) { // howcom here we get to know its bar but not before? var IncomingXElementNodeAsXText = IncomingXElementNode as XText; if (IncomingXElementNodeAsXText != null) { //Console.WriteLine("enter __XNode IncomingXElementNodeAsXText " + new { IncomingXElementNodeAsXText }); //Console.WriteLine("enter __XNode IncomingXElementNodeAsXText " + new { IncomingXElementNodeAsXText.Value }); } else { //Console.WriteLine("enter __XNode InternalRebuildDocument " + new { IncomingXElementNode }); } } // first reset the underlying node IncomingXElement.InternalValue = that.InternalValue.ownerDocument.createElement( IncomingXElement.InternalValue.nodeName ); foreach (var item in IncomingXElementAttributes) { IncomingXElement.Add( new XAttribute(item.Name, item.Value) ); } //Console.WriteLine("enter __XNode InternalRebuildDocument Add " + new { IncomingXElementNodes.Length }); IncomingXElement.Add(IncomingXElementNodes); //Console.WriteLine(" ok, force import manually done!"); }