public override void append(log4javascript.LoggingEvent loggingEvent) { string messag = this.getFormatedMessage(loggingEvent); HtmlOptionElement opt = new HtmlOptionElement(messag, "", false, true); this._el.options.add(opt); }
public override DomElement CreateElement(string prefix, string localName) { //actual dom implementation *** HtmlElement htmlElement; switch (localName) { case "img": { htmlElement = new HtmlImageElement( this, AddStringIfNotExists(prefix), AddStringIfNotExists(localName)); } break; case "input": { //input type htmlElement = new HtmlInputElement( this, AddStringIfNotExists(prefix), AddStringIfNotExists(localName)); } break; case "textarea": { htmlElement = new HtmlTextAreaElement( this, AddStringIfNotExists(prefix), AddStringIfNotExists(localName)); } break; case "option": { htmlElement = new HtmlOptionElement( this, AddStringIfNotExists(prefix), AddStringIfNotExists(localName)); } break; default: { htmlElement = new HtmlElement(this, AddStringIfNotExists(prefix), AddStringIfNotExists(localName)); htmlElement.WellknownElementName = WellKnownDomNodeMap.EvaluateTagName(htmlElement.LocalName); } break; } return(htmlElement); }
public static HtmlOptionElement CreateHtmlOption(this HtmlDocument doc, Decorate <HtmlOptionElement> dec = null) { var elem = new HtmlOptionElement( doc, 0, doc.AddStringIfNotExists("option")); dec?.Invoke(elem); return(elem); }
public void NotifySelectedSetsSelected() { var option = new HtmlOptionElement(); option.NotifyValue(new ElementEventValue { Checked = true, }); Assert.True(option.Selected); }
public void OptionWithValueGetsSelected() { var select = new HtmlSelectElement { Value = "lolo" }; var option = new HtmlOptionElement { Value = "lolo" }; select.AppendChild(option); Assert.True(option.Selected); }
public void LoopSelectOptions() { var select = new HtmlSelectElement(); var option1 = new HtmlOptionElement(); var group = Element.Create("optgroup"); var option2 = new HtmlOptionElement(); group.AppendChild(option2); select.AppendChild(option1); select.AppendChild(group); Assert.Equal(new List <HtmlOptionElement> { option1, option2 }, select.Options); }
public void AddSelectedOptionInGroup() { var select = new HtmlSelectElement { Value = "lolo" }; var option = new HtmlOptionElement { Value = "lolo" }; var group = new HtmlOptionGroupElement(); select.AppendChild(group); group.AppendChild(option); Assert.True(option.Selected); }
public static HtmlElement CreateHtmlElement(this HtmlDocument doc, string prefix, string localName) { //wellknown name? HtmlElement htmlElement; switch (localName) { case "img": { htmlElement = new HtmlImageElement( doc, doc.AddStringIfNotExists(prefix), doc.AddStringIfNotExists(localName)); } break; case "input": { //input type htmlElement = new HtmlInputElement( doc, doc.AddStringIfNotExists(prefix), doc.AddStringIfNotExists(localName)); } break; case "option": { htmlElement = new HtmlOptionElement( doc, doc.AddStringIfNotExists(prefix), doc.AddStringIfNotExists(localName)); } break; default: { htmlElement = new HtmlElement(doc, doc.AddStringIfNotExists(prefix), doc.AddStringIfNotExists(localName)); htmlElement.WellknownElementName = WellKnownDomNodeMap.EvaluateTagName(htmlElement.LocalName); } break; } return(htmlElement); }
public void SelectValueChangeOnChildOptions() { var select = new HtmlSelectElement(); var opt1 = new HtmlOptionElement { Value = "a" }; var opt2 = new HtmlOptionElement { Value = "b" }; var group = new HtmlOptionGroupElement(); group.AppendChild(opt2); select.AppendChild(opt1); select.AppendChild(group); select.Value = "a"; Assert.True(opt1.Selected); Assert.False(opt2.Selected); select.Multiple = true; select.Value = "b"; Assert.True(opt1.Selected); Assert.True(opt2.Selected); }
public static void UpdateDropdown() { HtmlSelectElement select = HtmlSelectElement.GetById("name"); JsString selectedText = null; if (select.selectedIndex != -1) { selectedText = select.options[select.selectedIndex].text; } //remove all options foreach (HtmlOptionElement option in select.options) { select.Remove(option); } //add all options JsArray <JsString> cookies = Xdk.cache.GetCookieList(); for (int i = 0; i < cookies.length; i++) { HtmlOptionElement option = new HtmlOptionElement(cookies[i], Xdk.cache.GetCookie(cookies[i]), true, true); select.Add(option, null); } //set selected if it is still there if (selectedText != null) { foreach (HtmlOptionElement option in select.options) { if (option.text == selectedText) { option.selected = true; break; } } } ShowCookie(); }
public void Add(HtmlOptionElement option, int index) { }
public void Add(HtmlOptionElement option) { }
public static void UpdateDropdown() { HtmlSelectElement select = HtmlSelectElement.GetById("name"); JsString selectedText = null; if (select.selectedIndex != -1) { selectedText = select.options[select.selectedIndex].text; } //remove all options foreach (HtmlOptionElement option in select.options) { select.Remove(option); } //add all options JsArray<JsString> cookies = Xdk.cache.GetCookieList(); for (int i = 0; i < cookies.length; i++) { HtmlOptionElement option = new HtmlOptionElement(cookies[i], Xdk.cache.GetCookie(cookies[i]), true, true); select.Add(option, null); } //set selected if it is still there if (selectedText != null) { foreach (HtmlOptionElement option in select.options) { if (option.text == selectedText) { option.selected = true; break; } } } ShowCookie(); }