1 | using System;
|
---|
2 | using System.Xml;
|
---|
3 |
|
---|
4 | using SharpVectors.Dom.Events;
|
---|
5 |
|
---|
6 | namespace SharpVectors.Dom
|
---|
7 | {
|
---|
8 | /// <summary>
|
---|
9 | /// Summary description for Whitespace.
|
---|
10 | /// </summary>
|
---|
11 | public class Whitespace
|
---|
12 | : XmlWhitespace
|
---|
13 | , INode
|
---|
14 | , IEventTargetSupport
|
---|
15 | {
|
---|
16 | #region Private Fields
|
---|
17 |
|
---|
18 | private EventTarget eventTarget;
|
---|
19 |
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | #region Constructors
|
---|
23 |
|
---|
24 | protected internal Whitespace(
|
---|
25 | string data,
|
---|
26 | Document document)
|
---|
27 | : base(data, document)
|
---|
28 | {
|
---|
29 | eventTarget = new EventTarget(this);
|
---|
30 | }
|
---|
31 |
|
---|
32 | #endregion
|
---|
33 |
|
---|
34 | #region IEventTarget interface
|
---|
35 |
|
---|
36 | #region Methods
|
---|
37 |
|
---|
38 | #region DOM Level 2
|
---|
39 |
|
---|
40 | void IEventTarget.AddEventListener(
|
---|
41 | string type,
|
---|
42 | EventListener listener,
|
---|
43 | bool useCapture)
|
---|
44 | {
|
---|
45 | eventTarget.AddEventListener(type, listener, useCapture);
|
---|
46 | }
|
---|
47 |
|
---|
48 | void IEventTarget.RemoveEventListener(
|
---|
49 | string type,
|
---|
50 | EventListener listener,
|
---|
51 | bool useCapture)
|
---|
52 | {
|
---|
53 | eventTarget.RemoveEventListener(type, listener, useCapture);
|
---|
54 | }
|
---|
55 |
|
---|
56 | bool IEventTarget.DispatchEvent(
|
---|
57 | IEvent @event)
|
---|
58 | {
|
---|
59 | return eventTarget.DispatchEvent(@event);
|
---|
60 | }
|
---|
61 |
|
---|
62 | #endregion
|
---|
63 |
|
---|
64 | #region DOM Level 3 Experimental
|
---|
65 |
|
---|
66 | void IEventTarget.AddEventListenerNs(
|
---|
67 | string namespaceUri,
|
---|
68 | string type,
|
---|
69 | EventListener listener,
|
---|
70 | bool useCapture,
|
---|
71 | object eventGroup)
|
---|
72 | {
|
---|
73 | eventTarget.AddEventListenerNs(namespaceUri, type, listener, useCapture, eventGroup);
|
---|
74 | }
|
---|
75 |
|
---|
76 | void IEventTarget.RemoveEventListenerNs(
|
---|
77 | string namespaceUri,
|
---|
78 | string type,
|
---|
79 | EventListener listener,
|
---|
80 | bool useCapture)
|
---|
81 | {
|
---|
82 | eventTarget.RemoveEventListenerNs(namespaceUri, type, listener, useCapture);
|
---|
83 | }
|
---|
84 |
|
---|
85 | bool IEventTarget.WillTriggerNs(
|
---|
86 | string namespaceUri,
|
---|
87 | string type)
|
---|
88 | {
|
---|
89 | return eventTarget.WillTriggerNs(namespaceUri, type);
|
---|
90 | }
|
---|
91 |
|
---|
92 | bool IEventTarget.HasEventListenerNs(
|
---|
93 | string namespaceUri,
|
---|
94 | string type)
|
---|
95 | {
|
---|
96 | return eventTarget.HasEventListenerNs(namespaceUri, type);
|
---|
97 | }
|
---|
98 |
|
---|
99 | #endregion
|
---|
100 |
|
---|
101 | #endregion
|
---|
102 |
|
---|
103 | #endregion
|
---|
104 |
|
---|
105 | #region XmlNode interface
|
---|
106 |
|
---|
107 | public override string Value
|
---|
108 | {
|
---|
109 | get
|
---|
110 | {
|
---|
111 | return base.Value;
|
---|
112 | }
|
---|
113 | set
|
---|
114 | {
|
---|
115 | base.Value = value;
|
---|
116 |
|
---|
117 | // Mutation events: Notify document.
|
---|
118 | Document document = this.OwnerDocument as Document;
|
---|
119 |
|
---|
120 | if (document != null)
|
---|
121 | {
|
---|
122 | document.ReplacedText(this);
|
---|
123 | }
|
---|
124 | }
|
---|
125 | }
|
---|
126 |
|
---|
127 | #endregion
|
---|
128 |
|
---|
129 | #region NON-DOM
|
---|
130 |
|
---|
131 | void IEventTargetSupport.FireEvent(
|
---|
132 | IEvent @event)
|
---|
133 | {
|
---|
134 | eventTarget.FireEvent(@event);
|
---|
135 | }
|
---|
136 |
|
---|
137 | #endregion
|
---|
138 | }
|
---|
139 | }
|
---|