示例#1
0
 /// <summary>
 /// insert a new rule.  use -1 to append new.
 /// </summary>
 /// <param name="rule"></param>
 /// <param name="insertIndex">use -1 to insert new.</param>
 /// <returns></returns>
 public int insertRule(CSSRule rule, int insertIndex)
 {
     if (insertIndex > length || insertIndex < 0)
     {
         item.Add(rule);
         return(item.Count() - 1);
     }
     else
     {
         item.Insert(insertIndex, rule);
         return(insertIndex);
     }
 }
示例#2
0
 /// <summary>
 /// Update the rule declaration block.
 /// Only support update of Media/Style/Import rule.
 /// </summary>
 /// <param name="newRule"></param>
 /// <param name="merge">Merge the same selector(for media/style) or the same url.
 /// The first time use Merge=false, update should use merge.
 /// This is to prevent duplicate selector in the rule list. That will cause issue for modifying the cssText.
 /// </param>
 public void updateRuleText(CSSRule newRule)
 {
     if (newRule.type == enumCSSRuleType.STYLE_RULE)
     {
         updateStyleRule((CSSStyleRule)newRule, true);
     }
     else
     {
         if (newRule.type == enumCSSRuleType.MEDIA_RULE)
         {
             updateMediaRule((CSSMediaRule)newRule);
         }
         else
         {
             if (newRule.type == enumCSSRuleType.IMPORT_RULE)
             {
                 updateImportRule((CSSImportRule)newRule);
             }
         }
     }
     ///The rest rule are not supported for update.
 }
示例#3
0
 /// <summary>
 /// W3C standard API, supported, but this does not update cssText
 /// Kooboo application, use the insertOrUpdateRule
 /// </summary>
 /// <param name="rule"></param>
 /// <param name="insertIndex">The position in the list to insert. 0 = begin position</param>
 /// <returns></returns>
 public int insertRule(CSSRule rule, int insertIndex)
 {
     return(cssRules.insertRule(rule, insertIndex));
 }
示例#4
0
 public void appendRule(CSSRule rule)
 {
     insertRule(rule, -1);
 }