Ejemplo n.º 1
0
 public static List<HtmlNodeFacade> Echo(StyleSheet ss, HtmlNodeFacade node)
 {
     var newNode = node.ownerDocument.createElement("div");
     newNode.innerHTML = "you are there";
     node.innerHTML = "i am here";
     var returnObj = new List<HtmlNodeFacade>
     {
         node,
         newNode,
     };
     return returnObj;
 }
Ejemplo n.º 2
0
        private static Modes GetMode(HtmlNodeFacade node)
        {
            string mode = node.getAttribute(ModeAttribute);
            string tagName = node.tagName.ToLower();
            if (string.IsNullOrEmpty(mode))
            {
                switch (tagName)
                {
                    case "script":
                        string type = node.getAttribute("type");
                        if (!string.IsNullOrEmpty(type) && (type.ToLower() == "text/html" || type.ToLower() == "text/emmet"))
                        {
                            return Modes.ClientSideOnly;
                        }
                        //if (string.IsNullOrEmpty(mode)) redundant
                        {
                            string model = node.getAttribute(ModelAttribute);
                            return string.IsNullOrEmpty(model) ? Modes.ClientSideOnly : Modes.Both;
                        }
                    case "iframe":
                        return Modes.ClientSideOnly;
                    case "style":
                        return Modes.Unspecified;
                    case "form":
                        return Modes.ServerSideOnly;
                    default:
                        return Modes.ClientSideOnly;
                }
            }
            switch (mode)
            {
                case ClientSideMode:
                    return Modes.ClientSideOnly;
                case ServerSideMode:
                    return Modes.ServerSideOnly;
                case BothMode:
                    return Modes.Both;
                case HybridMode:
                    return Modes.Hybrid;
                case DependsMode:
                    return Modes.Depends;
                case NoneMode:
                    return Modes.None;
                default:
                    throw new NotSupportedException("Mode " + mode + " not supported");

            }
            
        }
Ejemplo n.º 3
0
 public HtmlNodeFacade replaceChild(HtmlNodeFacade newChild, HtmlNodeFacade oldChild)
 {
     return new HtmlNodeFacade( this._node.ReplaceChild(newChild._node, oldChild._node), this._ownerDoc);
 }
Ejemplo n.º 4
0
 public void removeChild(HtmlNodeFacade childNode)
 {
     this._node.RemoveChild(childNode._node);
 }
Ejemplo n.º 5
0
 public HtmlNodeFacade insertBefore(HtmlNodeFacade newChild, HtmlNodeFacade refChild)
 {
     return new HtmlNodeFacade( this._node.InsertBefore(newChild._node, refChild._node), this._ownerDoc);
 }
Ejemplo n.º 6
0
 public HtmlNodeFacade appendChild(HtmlNodeFacade child)
 {
     var parent = child.parentNode;
     var returnObj = this._node.AppendChild(child._node);
     if (parent != null)
     {
         parent.removeChild(child);
     }
     return new HtmlNodeFacade(returnObj, this._ownerDoc);
 }
Ejemplo n.º 7
0
 private static HtmlNodeFacade ProcessTransform(HtmlNodeFacade superDocNode, HtmlNodeFacade diffDocNode)
 {
     var diffNodeHierarchy = new Stack<HtmlNodeFacade>();
     diffNodeHierarchy.Push(diffDocNode);
     var differenceStack = new Stack<NodeDifference>();
     var differences = new List<NodeDifference>();
     ProcessNode(diffNodeHierarchy, differenceStack, differences);
     MergeDifferences(superDocNode, differences);
     return superDocNode;
 }
Ejemplo n.º 8
0
 public JQueryFacade jQuery(HtmlNodeFacade el)
 {
     var returnObj = new JQueryFacade(_doc)
     {
         _nodes = new List<HtmlNodeFacade>
         {
             el,
         },
     };
     return returnObj;
 }