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