コード例 #1
0
        public override Node CloneNode(Boolean deep = true)
        {
            var clone = new HTMLTemplateElement();
            CopyProperties(this, clone, deep);

            if (deep && _content != null)
            {
                clone._content = (DocumentFragment)_content.CloneNode(true);
                clone._content.OwnerDocument = OwnerDocument;
            }

            return clone;
        }
コード例 #2
0
        public override Node CloneNode(Boolean deep = true)
        {
            var clone = new HTMLTemplateElement();

            CopyProperties(this, clone, deep);

            if (deep && _content != null)
            {
                clone._content = (DocumentFragment)_content.CloneNode(true);
                clone._content.OwnerDocument = OwnerDocument;
            }

            return(clone);
        }
コード例 #3
0
        /// <summary>
        /// Returns a duplicate of the template including the contents if deep is specified.
        /// </summary>
        /// <param name="deep">Optional value: true if the children of the node should also be
        /// cloned, or false to clone only the specified node.</param>
        /// <returns>The duplicate node.</returns>
        public override INode Clone(Boolean deep = true)
        {
            var clone = new HTMLTemplateElement();

            CopyProperties(this, clone, deep);
            CopyAttributes(this, clone);

            for (int i = 0; i < _content.ChildNodes.Length; i++)
            {
                var node = _content.ChildNodes[i].Clone(deep) as Node;

                if (node != null)
                {
                    clone._content.AddNode(node);
                }
            }

            return(clone);
        }