attribute node
Inheritance: DomNode
Esempio n. 1
0
        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);
            //---------------------
        }
Esempio n. 2
0
        public void SetAttribute(string attrName, string value)
        {
            DomAttribute domAttr = this.OwnerDocument.CreateAttribute(null, attrName);

            domAttr.Value = value;
            SetAttribute(domAttr);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 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);
     //---------------------
 }
Esempio n. 5
0
        public DomAttribute CreateAttribute(string localName, string value)
        {
            var attr = new DomAttribute(this,
                                        0,
                                        _uniqueStringTable.AddStringIfNotExist(localName));

            attr.Value = value;
            return(attr);
        }
Esempio n. 6
0
 /// <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;
     }
 }
Esempio n. 7
0
 public override void SetAttribute(DomAttribute attr)
 {
     base.SetAttribute(attr);
     switch ((WellknownName)attr.LocalNameIndex)
     {
         case WellknownName.Style:
             {
                 //TODO: parse and evaluate style here 
                 //****
             }
             break;
     }
 }
Esempio n. 8
0
 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;
     }
 }
Esempio n. 9
0
        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);
            //---------------------
        }
Esempio n. 10
0
 public virtual void SetAttribute(DomAttribute attr)
 {
     SetDomAttribute(attr);
 }
Esempio n. 11
0
 protected virtual void OnElementChangedInIdleState(ElementChangeKind changeKind, DomAttribute attr)
 {
 }
Esempio n. 12
0
 /// <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());
 }
Esempio n. 13
0
 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);
 }