public override string ToString() { return(WrappedObject.ToString()); }
public override string AsString(WrappedObject obj) { return(obj.ToString()); }
public override string ToString() { return(ToStringConverter == null?WrappedObject.ToString() : ToStringConverter(WrappedObject)); }
public bool Dispatch() { //Initializing event progress flags PropagationStopped = false; ImmediatePropagationStopped = false; DefaultPrevented = false; var eventTarget = CurrentTarget as DOM.EventTarget; if (eventTarget != null) { Debug.WriteLine("TARGET = " + eventTarget.ToString()); } else { Debug.WriteLine("TARGET IS NULL"); } Phase = JSEvent.Phases.AtTarget; bool eventBubblingCancelled = false; if (eventTarget != null) { var eventListeners = eventTarget.GetEventListeners(Data.Type, false); if (eventListeners != null) { eventBubblingCancelled = eventListeners.HandleEvent(this); } if (eventListeners == null) { Debug.WriteLine("Listener list is null!"); } CurrentTarget = eventTarget.Parent as DOM.EventTarget; } //Implementing bubbling accroding to HTML Spec (Document Object Model Events section 1.2.3). if (this.Bubbles && eventTarget != null) { Debug.WriteLine("EVENT BUBBLING"); //Bubbling loop (outer loop) Phase = JSEvent.Phases.Bubbling; var bubllingTargetList = new List <DOM.EventTarget>(); var tempTarget = eventTarget.Parent as DOM.EventTarget; while (tempTarget != null) { bubllingTargetList.Add(tempTarget); tempTarget = tempTarget.Parent as DOM.EventTarget; } for (int i = 0; (i < bubllingTargetList.Count) && (!eventBubblingCancelled); i++) { CurrentTarget = bubllingTargetList[i]; tempTarget = CurrentTarget as DOM.EventTarget; if (tempTarget != null) { Debug.WriteLine("curr TARGET = " + CurrentTarget.ToString()); } var eventListeners = tempTarget.GetEventListeners(Data.Type, false); if (eventListeners != null) { eventBubblingCancelled = eventListeners.HandleEvent(this); } CurrentTarget = CurrentTarget.Parent; } } bool cancelled = (DefaultPrevented && Cancelable); if (hasDefaultAction) { if (!cancelled) { Debug.WriteLine("Performing default action!"); DefaultAction(); } else { Debug.WriteLine("Ignoring the default action as event Cancelable is {0} and cancelled flag is {1}", Cancelable, cancelled); } } //According to SPEC the return value is false if the default action is cancelled return(cancelled); }
public override string ToString() => WrappedObject.ToString();