public virtual void SetAttribute(DomAttribute attr) { if (myAttributes == null) { myAttributes = new Dictionary <int, DomAttribute>(); } //----------- //some wellknownattr switch ((WellknownName)attr.LocalNameIndex) { case WellknownName.Id: { this.attrElemId = attr; this.OwnerDocument.RegisterElementById(this); } break; case WellknownName.Class: { this.attrClass = attr; } break; } //-------------------- var attrNameIndex = this.OwnerDocument.AddStringIfNotExists(attr.LocalName); myAttributes[attrNameIndex] = attr;//update or replace attr.SetParent(this); NotifyChange(ElementChangeKind.AddAttribute); //--------------------- }
public void SetAttribute(string attrName, string value) { DomAttribute domAttr = this.OwnerDocument.CreateAttribute(null, attrName); domAttr.Value = value; SetAttribute(domAttr); }
public void AddAttribute(DomAttribute attr) { if (myAttributes == null) { myAttributes = new Dictionary <int, DomAttribute>(); } //----------- //some wellknownattr switch (attr.LocalNameIndex) { case (int)WellknownName.Id: { this.attrElemId = attr; this.OwnerDocument.RegisterElementById(this); } break; case (int)WellknownName.Class: { this.attrClass = attr; } break; } myAttributes.Add(attr.LocalNameIndex, attr); attr.SetParent(this); NotifyChange(ElementChangeKind.AddAttribute); }
public virtual void SetAttribute(DomAttribute attr) { if (myAttributes == null) { myAttributes = new Dictionary<int, DomAttribute>(); } //----------- //some wellknownattr switch ((WellknownName)attr.LocalNameIndex) { case WellknownName.Id: { this.attrElemId = attr; this.OwnerDocument.RegisterElementById(this); } break; case WellknownName.Class: { this.attrClass = attr; } break; } //-------------------- var attrNameIndex = this.OwnerDocument.AddStringIfNotExists(attr.LocalName); myAttributes[attrNameIndex] = attr;//update or replace attr.SetParent(this); NotifyChange(ElementChangeKind.AddAttribute); //--------------------- }
public DomAttribute CreateAttribute(string localName, string value) { var attr = new DomAttribute(this, 0, _uniqueStringTable.AddStringIfNotExist(localName)); attr.Value = value; return(attr); }
/// <summary> /// when we change dom element, the change may affect some part of dom/ or entire document /// </summary> /// <param name="changeKind"></param> /// <param name="attr"></param> protected void NotifyChange(ElementChangeKind changeKind, DomAttribute attr) { switch (this.DocState) { case DocumentState.ChangedAfterIdle: case DocumentState.Idle: //notify parent OnElementChangedInIdleState(changeKind, attr); break; } }
public override void SetAttribute(DomAttribute attr) { base.SetAttribute(attr); switch ((WellknownName)attr.LocalNameIndex) { case WellknownName.Style: { //TODO: parse and evaluate style here //**** } break; } }
public bool TryGetAttribute(WellknownName wellknownHtmlName, out DomAttribute result) { var found = base.FindAttribute((int)wellknownHtmlName); if (found != null) { result = found; return true; } else { result = null; return false; } }
protected void SetDomAttribute(DomAttribute attr) { //some wellknownattr switch ((WellknownName)attr.LocalNameIndex) { case WellknownName.Id: { _attrElemId = attr; this.OwnerDocument.RegisterElementById(this); } break; case WellknownName.Class: { _attrClass = attr; } break; case WellknownName.Style: { _attrStyle = attr; } break; default: { if (_myAttributes == null) { _myAttributes = new Dictionary <int, DomAttribute>(); } //-------------------- int attrNameIndex = this.OwnerDocument.AddStringIfNotExists(attr.LocalName); _myAttributes[attrNameIndex] = attr; //update or replace } break; } attr.SetParent(this); NotifyChange(ElementChangeKind.SetAttribute, attr); //--------------------- }
public virtual void SetAttribute(DomAttribute attr) { SetDomAttribute(attr); }
protected virtual void OnElementChangedInIdleState(ElementChangeKind changeKind, DomAttribute attr) { }
/// <summary> /// Converts an HTML length into a Css length /// </summary> /// <param name="htmlLength"></param> /// <returns></returns> public static CssLength TranslateLength(DomAttribute attr) { return UserMapUtil.TranslateLength(attr.Value.ToLower()); }
public void AddAttribute(DomAttribute attr) { if (myAttributes == null) { myAttributes = new Dictionary<int, DomAttribute>(); } //----------- //some wellknownattr switch (attr.LocalNameIndex) { case (int)WellknownName.Id: { this.attrElemId = attr; this.OwnerDocument.RegisterElementById(this); } break; case (int)WellknownName.Class: { this.attrClass = attr; } break; } myAttributes.Add(attr.LocalNameIndex, attr); attr.SetParent(this); NotifyChange(ElementChangeKind.AddAttribute); }