Ejemplo n.º 1
0
        public static void RelList()
        {
            var doc    = DomImplementation.Instance.CreateHtmlDocument();
            var anchor = new HtmlAnchorElement(doc);

            Assert.AreEqual(0, anchor.RelList.Count);
            anchor.Rel = "hello world";
            Assert.AreEqual(new[] { "hello", "world" }, anchor.RelList);
            anchor.RelList.Remove("hello");
            Assert.AreEqual("world", anchor.Rel);
        }
        /// <summary>
        /// Checks if source element is an anchor and handles the click if it is.
        /// </summary>
        private bool TryHandleAnchorClick(HtmlElement source, out BrowserInfo browserInfo)
        {
            browserInfo = null;
            HtmlAnchorElement anchor = source as HtmlAnchorElement;

            if (anchor != null)
            {
                if (!anchor.CachedAttributes.Dictionary.ContainsKey("href"))
                {
                    throw new InvalidOperationException(CLICKANCHOR_HREFNOTFOUND);
                }

                Uri url = new Uri(this._emulator.CurrentUri, anchor.CachedAttributes.HRef);

                browserInfo = PerformRequest(url.AbsoluteUri);

                return(true);
            }
            return(false);
        }