Пример #1
0
 public void CreateMap()
 {
     var document = new HtmlDocument();
     a = new HtmlElement(document, "a");
     a.SetAttribute("data-test1", "test");
     a.SetAttribute("data-b", "b");
     stringMap = new StringMap("data-", a);
 }
Пример #2
0
 /// <summary>
 /// Constucts the data set (called from a form).
 /// </summary>
 /// <param name="dataSet">The dataset to construct.</param>
 /// <param name="submitter">The given submitter.</param>
 internal override void ConstructDataSet(FormDataSet dataSet, HtmlElement submitter)
 {
     ConstructDataSet(dataSet, Type);
 }
Пример #3
0
 /// <summary>
 /// Constucts the data set (called from a form).
 /// </summary>
 /// <param name="dataSet">The dataset to construct.</param>
 /// <param name="submitter">The given submitter.</param>
 internal virtual void ConstructDataSet(FormDataSet dataSet, HtmlElement submitter)
 { }
Пример #4
0
        internal override void ConstructDataSet(FormDataSet dataSet, HtmlElement submitter)
        {
            var options = Options;

            for (int i = 0; i < options.Length; i++)
            {
                var option = options.GetOptionAt(i);

                if (option.IsSelected && !option.IsDisabled)
                    dataSet.Append(Name, option.Value, Type);
            }
        }
        FormDataSet ConstructDataSet(HtmlElement submitter = null)
        {
            var formDataSet = new FormDataSet();

            foreach (var field in Elements)
            {
                if (field.ParentElement is IHtmlDataListElement == false && field.IsDisabled == false)
                    field.ConstructDataSet(formDataSet, submitter);
            }

            return formDataSet;
        }
        void SubmitForm(HtmlElement from, Boolean submittedFromSubmitMethod)
        {
            var owner = Owner;
            var browsingContext = owner.Context;

            if (owner.ActiveSandboxing.HasFlag(Sandboxes.Forms))
                return;

            if (!submittedFromSubmitMethod && !from.Attributes.Any(m => m.Name == AttributeNames.FormNoValidate) && NoValidate && !CheckValidity())
            {
                this.FireSimpleEvent(EventNames.Invalid);
                return;
            }

            var action = String.IsNullOrEmpty(Action) ? new Url(owner.DocumentUri) : this.HyperReference(Action);
            var createdBrowsingContext = false;
            var targetBrowsingContext = owner.Context;
            var target = Target;

            if (!String.IsNullOrEmpty(target))
            {
                targetBrowsingContext = owner.GetTarget(target);

                if (createdBrowsingContext = (targetBrowsingContext == null))
                    targetBrowsingContext = owner.CreateTarget(target);
            }

            var replace = createdBrowsingContext || owner.ReadyState != DocumentReadyState.Complete;
            var scheme = action.Scheme;
            var method = Method.ToEnum(HttpMethod.Get);
            _current = SubmitForm(method, scheme, action);
        }