Exemple #1
0
        public void append(Node nodes)
        {
            if (nodes.childNodes.Contains(this))
                throw new DOMException(ExceptionCodes.HIERARCHY_REQUEST_ERR);

            insertBefore(nodes, null);
        }
Exemple #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;
        }
 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;
 }
Exemple #4
0
        public Node(Document doc)
        {
            ownerDocument = doc;
            _parentNode = doc;
            //if (_parentNode == null)
            //{

            //}
        }
Exemple #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;
        }
Exemple #6
0
        //NEW (SUPPORTED!)
        public void prepend(Node nodes)
        {
            if (children.length <= 0)
                return;

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

            children[0].prepend(nodes);
        }
Exemple #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);
        }
Exemple #8
0
 internal bool Contains(Node node)
 {
     foreach (var item in this)
     {
         if (node == item)
         {
             return true;
         }
     }
     return false;
 }
Exemple #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]);
            }
        }
Exemple #10
0
 public void setEndAfter(Node refNode)
 {
     throw new NotImplementedException();
 }
Exemple #11
0
 public void setStart(Node refNode, long offset)
 {
     throw new NotImplementedException();
 }
Exemple #12
0
 public bool isPointInRange(Node node, long offset)
 {
     throw new NotImplementedException();
 }
Exemple #13
0
 public void selectNodeContents(Node refNode)
 {
     throw new NotImplementedException();
 }
Exemple #14
0
        public bool MoveNext()
        {
            if (isFirst)
            {
                isFirst = false;
            }
            else if (current != null)
            {
                current = current.nextSibling;
            }

            return current != null;
        }
Exemple #15
0
 public bool intersectsNode(Node node)
 {
     throw new NotImplementedException();
 }
Exemple #16
0
 public short comparePoint(Node node, long offset)
 {
     throw new NotImplementedException();
 }
 public void observe(Node target, MutationObserverInit options);
Exemple #18
0
 public TreeWalker createTreeWalker(Node root, long whatToShow = NodeFilter.SHOW_ALL, NodeFilter filter = null)
 {
     return new TreeWalker(root, whatToShow, filter);
 }
Exemple #19
0
 public void setStartBefore(Node refNode)
 {
     throw new NotImplementedException();
 }
Exemple #20
0
 public NodeIterator createNodeIterator(Node root, long whatToShow = NodeFilter.SHOW_ALL, NodeFilter filter = null)
 {
     return new NodeIterator(root, whatToShow, filter);
 }
Exemple #21
0
 public Node adoptNode(Node node)
 {
     throw new NotImplementedException();
 }
Exemple #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;
        }
Exemple #23
0
 public NodeIterator(Node root, long whatToShow, NodeFilter filter)
     : base(root, whatToShow, filter)
 {
     this.referenceNode = root;
     this.pointerBeforeReferenceNode = true;
 }
Exemple #24
0
 public void Reset()
 {
     current = parent.firstChild;
     isFirst = true;
 }
Exemple #25
0
 public void surroundContents(Node newParent)
 {
     throw new NotImplementedException();
 }
Exemple #26
0
 public void prepend(Node nodes)
 {
     throw new NotImplementedException();
 }
Exemple #27
0
 public void insertNode(Node node)
 {
     throw new NotImplementedException();
 }
Exemple #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);
        }
Exemple #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;
        }
Exemple #30
0
 public NodeList(Node parent)
 {
     this.parent = parent;
 }