internal MutationObserverInit(IMutationObserverInit original)
 {
     ObserveTargetAttributes = original.ObserveTargetAttributes;
     AttributeFilters = original.AttributeFilters.ToArray();
     ObserveTargetChildNodes = original.ObserveTargetChildNodes;
     ObserveTargetData = original.ObserveTargetData;
     ObserveTargetDescendents = original.ObserveTargetDescendents;
     StorePreviousAttributeValue = original.StorePreviousAttributeValue;
     StorePreviousDataValue = original.StorePreviousDataValue;
 }
Ejemplo n.º 2
0
 internal MutationObserverInit(IMutationObserverInit original)
 {
     ObserveTargetAttributes     = original.ObserveTargetAttributes;
     AttributeFilters            = original.AttributeFilters.ToArray();
     ObserveTargetChildNodes     = original.ObserveTargetChildNodes;
     ObserveTargetData           = original.ObserveTargetData;
     ObserveTargetDescendents    = original.ObserveTargetDescendents;
     StorePreviousAttributeValue = original.StorePreviousAttributeValue;
     StorePreviousDataValue      = original.StorePreviousDataValue;
 }
Ejemplo n.º 3
0
        public void Connect(INode target, IMutationObserverInit options)
        {
            //TODO Mutation

            if (options.StorePreviousDataValue.HasValue == false)
            {
                options.StorePreviousDataValue = false;
            }

            if (options.StorePreviousAttributeValue.HasValue == false)
            {
                options.StorePreviousAttributeValue = false;
            }

            if (options.ObserveTargetAttributes.HasValue == false)
            {
                options.ObserveTargetAttributes = options.StorePreviousAttributeValue.Value || options.AttributeFilters != null;
            }

            if (options.ObserveTargetData.HasValue == false)
            {
                options.ObserveTargetData = options.StorePreviousDataValue.HasValue && options.StorePreviousDataValue.Value;
            }

            if (options.StorePreviousAttributeValue.Value && options.ObserveTargetAttributes.Value == false)
            {
                throw new DomException(ErrorCode.TypeMismatch);
            }

            if (options.AttributeFilters != null && options.ObserveTargetAttributes.Value == false)
            {
                throw new DomException(ErrorCode.TypeMismatch);
            }

            if (options.StorePreviousDataValue.Value && options.ObserveTargetData.Value == false)
            {
                throw new DomException(ErrorCode.TypeMismatch);
            }

            if (_observing.Contains(target))
            {
                //6.1 Remove all transient registered observers whose source is registered.
                //6.2 Replace registered's options with options.
            }
            else
            {
                //7. Otherwise, add a new registered observer to target's list of registered
                //observers with the context object as the observer and options as the options,
                //and add target to context object's list of nodes on which it is registered.
                _observing.Add(target);
            }
        }
Ejemplo n.º 4
0
        public void Connect(INode target, IMutationObserverInit options)
        {
            //TODO

            if (options.StorePreviousDataValue.HasValue == false)
                options.StorePreviousDataValue = false;

            if (options.StorePreviousAttributeValue.HasValue == false)
                options.StorePreviousAttributeValue = false;

            if (options.ObserveTargetAttributes.HasValue == false)
                options.ObserveTargetAttributes = options.StorePreviousAttributeValue.Value || options.AttributeFilters != null;

            if (options.ObserveTargetData.HasValue == false)
                options.ObserveTargetData = options.StorePreviousDataValue.HasValue && options.StorePreviousDataValue.Value;

            if (options.StorePreviousAttributeValue.Value && options.ObserveTargetAttributes.Value == false)
                throw new DomException(ErrorCode.TypeMismatch);

            if (options.AttributeFilters != null && options.ObserveTargetAttributes.Value == false)
                throw new DomException(ErrorCode.TypeMismatch);

            if (options.StorePreviousDataValue.Value && options.ObserveTargetData.Value == false)
                throw new DomException(ErrorCode.TypeMismatch);

            if (_observing.Contains(target))
            {
                //6.1 Remove all transient registered observers whose source is registered.
                //6.2 Replace registered's options with options.
            }
            else
            {
                //7. Otherwise, add a new registered observer to target's list of registered
                //observers with the context object as the observer and options as the options,
                //and add target to context object's list of nodes on which it is registered.
                _observing.Add(target);
            }
        }