Пример #1
0
        public void append(Node nodes)
        {
            if (nodes.childNodes.Contains(this))
                throw new DOMException(ExceptionCodes.HIERARCHY_REQUEST_ERR);

            insertBefore(nodes, null);
        }
Пример #2
0
        protected int Filter(Node node)
        {
            if (_activeFlag)
            {
                throw new DOMError("The object is in an invalid state.");
            }

            int nodeType = node.nodeType;

            if (!((whatToShow)whatToShow).HasFlag((whatToShow)((1 << nodeType) / 2)))
            {
                return FilterResult.FILTER_SKIP;
            }
            if (filter == null)
            {
                return FilterResult.FILTER_ACCEPT;
            }
            _activeFlag = true;

            int result;
            try
            {
                result = filter.acceptNode(node);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                _activeFlag = false;
            }

            return result;
        }
Пример #3
0
 public NodeChangedEventArgs(Node node, Node oldParent, Node newParent, string oldValue, string newValue, NodeChangedAction action)
 {
     this.Node = node;
     this.OldParent = oldParent;
     this.NewParent = newParent;
     this.Action = action;
     this.OldValue = oldValue;
     this.NewValue = newValue;
 }
Пример #4
0
        public Node(Document doc)
        {
            ownerDocument = doc;
            _parentNode = doc;
            //if (_parentNode == null)
            //{

            //}
        }
Пример #5
0
        public void initMutationEvent(string typeArg, bool canBubbleArg, bool cancelableArg, Node relatedNodeArg, string prevValueArg, string newValueArg, string attrNameArg, short attrChangeArg)
        {
            base.initEvent(typeArg, canBubbleArg, cancelableArg);

            relatedNode = relatedNodeArg;
            prevValue = prevValueArg;
            newValue = newValueArg;
            attrName = attrNameArg;
            attrChange = attrChangeArg;
        }
Пример #6
0
        //NEW (SUPPORTED!)
        public void prepend(Node nodes)
        {
            if (children.length <= 0)
                return;

            if (children[0] == null)
                return;

            children[0].prepend(nodes);
        }
Пример #7
0
        public void after(Node nodes)
        {
            if (this.parentNode == null)
                return;
            if (nodes.childNodes.Contains(this))
                throw new DOMException(ExceptionCodes.HIERARCHY_REQUEST_ERR);
            //Run the mutation method macro.

            parentNode.insertBefore(nodes, this.nextSibling);
        }
Пример #8
0
 internal bool Contains(Node node)
 {
     foreach (var item in this)
     {
         if (node == item)
         {
             return true;
         }
     }
     return false;
 }
Пример #9
0
        public void prepend(Node nodes)
        {
            if (nodes.childNodes.Contains(this))
                throw new DOMException(ExceptionCodes.HIERARCHY_REQUEST_ERR);

            //Run the mutation method macro.
            //Pre-insert node into the context object before the context object's first child.
            if (this.childNodes.length == 0)
            {
                append(nodes);
            }
            else
            {
                insertBefore(nodes, this.childNodes[0]);
            }
        }
Пример #10
0
 public void setEndAfter(Node refNode)
 {
     throw new NotImplementedException();
 }
Пример #11
0
 public void setStart(Node refNode, long offset)
 {
     throw new NotImplementedException();
 }
Пример #12
0
 public bool isPointInRange(Node node, long offset)
 {
     throw new NotImplementedException();
 }
Пример #13
0
 public void selectNodeContents(Node refNode)
 {
     throw new NotImplementedException();
 }
Пример #14
0
        public bool MoveNext()
        {
            if (isFirst)
            {
                isFirst = false;
            }
            else if (current != null)
            {
                current = current.nextSibling;
            }

            return current != null;
        }
Пример #15
0
 public bool intersectsNode(Node node)
 {
     throw new NotImplementedException();
 }
Пример #16
0
 public short comparePoint(Node node, long offset)
 {
     throw new NotImplementedException();
 }
Пример #17
0
 public void observe(Node target, MutationObserverInit options);
Пример #18
0
 public TreeWalker createTreeWalker(Node root, long whatToShow = NodeFilter.SHOW_ALL, NodeFilter filter = null)
 {
     return new TreeWalker(root, whatToShow, filter);
 }
Пример #19
0
 public void setStartBefore(Node refNode)
 {
     throw new NotImplementedException();
 }
Пример #20
0
 public NodeIterator createNodeIterator(Node root, long whatToShow = NodeFilter.SHOW_ALL, NodeFilter filter = null)
 {
     return new NodeIterator(root, whatToShow, filter);
 }
Пример #21
0
 public Node adoptNode(Node node)
 {
     throw new NotImplementedException();
 }
Пример #22
0
        private Node Traverse(bool directionNext)
        {
            Node next = null;
            bool beforeNode = pointerBeforeReferenceNode;

            while (true)
            {
                if (directionNext)
                {
                    if (beforeNode)
                    {
                        beforeNode = false;
                    }
                    else
                    {
                        next = referenceNode.nextSibling;
                        if (next == null)
                        {
                            return null;
                        }
                    }
                }
                else
                {
                    if (beforeNode)
                    {
                        next = referenceNode.previousSibling;
                        if (next == null)
                        {
                            return null;
                        }
                    }
                    else
                    {
                        beforeNode = true;
                    }
                }

                int result;
                try
                {
                    result = base.Filter(next);
                }
                catch (Exception)
                {
                    return null;
                }

                if (result == FilterResult.FILTER_ACCEPT)
                {
                    break;
                }
            }

            pointerBeforeReferenceNode = beforeNode;
            referenceNode = next;
            return next;
        }
Пример #23
0
 public NodeIterator(Node root, long whatToShow, NodeFilter filter)
     : base(root, whatToShow, filter)
 {
     this.referenceNode = root;
     this.pointerBeforeReferenceNode = true;
 }
Пример #24
0
 public void Reset()
 {
     current = parent.firstChild;
     isFirst = true;
 }
Пример #25
0
 public void surroundContents(Node newParent)
 {
     throw new NotImplementedException();
 }
Пример #26
0
 public void prepend(Node nodes)
 {
     throw new NotImplementedException();
 }
Пример #27
0
 public void insertNode(Node node)
 {
     throw new NotImplementedException();
 }
Пример #28
0
        internal NodeChangedEventArgs GetEventArgs(Node node, Node oldParent, Node newParent, string oldValue, string newValue, NodeChangedAction action)
        {
            reportValidity = false;

            switch (action)
            {
                case NodeChangedAction.Insert:
                    if (onNodeInsertingDelegate == null && onNodeInsertedDelegate == null)
                    {
                        return null;
                    }
                    break;
                case NodeChangedAction.Remove:
                    if (onNodeRemovingDelegate == null && onNodeRemovedDelegate == null)
                    {
                        return null;
                    }
                    break;
                case NodeChangedAction.Change:
                    if (onNodeChangingDelegate == null && onNodeChangedDelegate == null)
                    {
                        return null;
                    }
                    break;
            }
            return new NodeChangedEventArgs(node, oldParent, newParent, oldValue, newValue, action);
        }
Пример #29
0
        public Node importNode(Node node, bool deep = true)
        {
            if (node.nodeType == (int)NodeType.DOCUMENT_NODE)
            {
                throw new DOMError("The operation is not supported.");
            }

            Node n = node.cloneNode(deep);
            n.ownerDocument = this;

            return n;
        }
Пример #30
0
 public NodeList(Node parent)
 {
     this.parent = parent;
 }