1、 KSKSKSKSKSKSKSK KSKSKS KSKSK KSKS KSK KS KS X 6047 3 (DOM) 2 KS X 6047 3:2011 2011 12 30 http:/www.kats.go.krKS X 6047 3:2011 : e- ( ) ( ) () () ( ) : () () DRM ( ) KS X 6047 3:2011 : (http:/www.standard.go.kr) : :2011 12 30 2011-0689 : e- : ( 02-509-7262) (http:/www.kats.go.kr). 10 5 , . KS X 6047
2、 3:2011 i ii iii 1 1 2 1 3 .1 4 DOM 2 .2 5 .3 5.1 .3 5.2 3 5.3 (bubbling) 4 5.4 4 6 (listener) 4 6.1 4 6.2 HTML 4.0 (listener) .7 7 Event 7 8 Document Event 10 9 11 9.1 .11 9.2 .13 9.3 Key events17 9.4 Mutation event types 17 9.5 HTML 21 A( ) IDL .24 B( ) JAVA Language Binding 27 C( ) ECMAScript Lan
3、guage Binding .31 KS X 6047 3:2011 .35 KS X 6047 3:2011 ii . , , . , , . DOM . DOM XML HTML programmatic interface , . DOM Level 2 . DOM Level 2 Core DOM Level 2 Views DOM Level 2 Events DOM Level 2 Style DOM Level 2 Traversal and Range DOM Level 2 HTML DOM Level 2 Events . KS X 6047 3:2011 iii Worl
4、d Wide Web Consortium(W3C) 2000 Document Object Model(DOM) Level 2 Events 1.0 , . DOM , API . . KS X 6047 3:2011 (DOM) 2 Document Object Model(DOM) level 2 events 1 2 (Events) , . 2 2 (DOM Level 2 Core) 2 (DOM Level 2 Views) . 2 . . ( ) . DOM Level 2 Core, W3C(World Wide Web Consortium) Document Obj
5、ect Model Level 2 Core Specification, November 2000. Available at http:/www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113 ECMAScript, ECMA(European Computer Manufacturers Association) ECMAScript Language Specification. Available at http:/www.ecma.ch/ecma1/STAND/ECMA-262.HTM Java, Sun Microsystems Inc
6、. The Java Language Specification, James Gosling, Bill Joy, and Guy Steele, September 1996. Available at http:/ OMGIDL, OMG(Object Management Group) IDL(Interface Definition Language) defined in The Common Object Request Broker: Architecture and Specification, version 2.3.1, October 1999. Available
7、from http:/www.omg.org/ DOM Level 2 Views, W3C(World Wide Web Consortium) Document Object Model Level 2 Views Specification, November 2000. Available at http:/www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113 XML, W3C(World Wide Web Consortium) Extensible Markup Language(XML) 1.0, February 1998. Ava
8、ilable at http:/www.w3.org/TR/1998/REC-xml-19980210 3 . 3.1 UI . ( , ) . KS X 6047 3:2011 2 3.2 UI (focus change message) (element triggering notifications) 3.3 3.4 (capturing) 3.5 (bubbling) (ancestors) 3.6 (cancelable) A 4 DOM 2 DOM 2 . (handler) . , . , (notifications) . DOM 0 . . . . DOM . (list
9、ener) , Event . . DOM DOMImplementation hasFeature(feature, version) “Events” “2.0” . 2 (DOM Level 2 Core) “Core” . DOM 2 (conformance in the DOM Level 2 Core specification) . . KS X 6047 3:2011 3 5 DOM . . EventTarget EventTarget . 5.1 DOM EventTarget . EventTarget Event target . , EventTarget (lis
10、teners) . EventTarget EventListeners EventTarget . EventTarget EventListeners . . , . EventListener . EventListener . EventListener . , . 5.2 (capture) ancestor EventListener . (capture) . Document , . EventTarget . , . EventTarget EventListener addEventListener useCapture true EventListener . , (de
11、scendant) , . . EventListener EventTarget . EventListener , Event stopProgagation . EventListeners . stopPropagation , . , stopPropagation EventListeners . KS X 6047 3:2011 4 (listener) , . , EventTarget (descendants) (interception) . , (ancestors), (siblings) (descendants) . , EventTarget , . (capt
12、urer) (descendants) . 5.3 (bubbling) (bubbling) . EventTarget , (listener) . EventTarget EventTarget . Document Document . (capturer) EventListener . EventTarget . , . (handler) Event stopPropagation . EventListener EventTarget EventListener . . stopPropagation . 5.4 . DOM . . , . , (listener) , . .
13、 , . Event preventDefault . EventListeners preventDefault . . DOM . 6 (listener) 6.1 EventTarget(DOM 2 .) EventTarget DOM . KS X 6047 3:2011 5 Node (binding-specific) . EventTarget EventListeners , EventTarget . IDL / DOM 2 .: interface EventTarget void addEventListener(in DOMString type, in EventLi
14、stener listener, in boolean useCapture); void removeEventListener(in DOMString type, in EventListener listener, in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); ; addEventListener (listener) . EventListener EventTarget , . . EventListener EventTarget , . , EventLis
15、tener . removeEventListener . DOMString type EventListener listener listener . boolean useCapture true , useCapture . EventTargets EventListener . EventListener . . . dispatchEvent . . dispatchEvent EventTarget . Event evt KS X 6047 3:2011 6 , , boolean: dispatchEvent preventDefault . preventDefault
16、 false, true EventException UNSPECIFIED_EVENT_TYPE_ERR: dispatchEvent Event . null . removeEventListener . EventListener EventTarget . EventListener EventTarget removeEventListener . DOMString type EventListener . EventListener listener EventListener EventListener . boolean useCapture EventListener
17、. (listener) , , . (listener) , . . . EventListener(DOM 2 .) EventListener . EventListener AddEventListener EventTarget (listener) . EventTarget EventListener . cloneNode , Node EventListener Node . EventListener , . IDL / DOM 2 .: interface EventListener KS X 6047 3:2011 7 void handleEvent(in Event
18、 evt); ; handleEvent EventListener . Event evt Event , stopPropagation preventDefault . . . 6.2 HTML 4.0 (listener) HTML 4.0 , (listener) . . DOM EventTarget . , . HTML 4.0 , EventTarget EventListener (handler) . useCapture false EventListener EventTarget EventListeners . , EventListener . HTML 4.0
19、(listener) . 7 Event Event(DOM 2 .) Event (handler) . Event (handler) . Event (handler) . (listener) . IDL / DOM 2 .: interface Event / PhaseType const unsigned short CAPTURING_PHASE = 1; const unsigned short AT_TARGET = 2; const unsigned short BUBBLING_PHASE = 3; readonly attribute DOMString type;
20、readonly attribute EventTarget target; KS X 6047 3:2011 8 readonly attribute EventTarget currentTarget; readonly attribute unsigned short eventPhase; readonly attribute boolean bubbles; readonly attribute boolean cancelable; readonly attribute DOMTimeStamp timeStamp; void stopPropagation(); void preventDefault(); void initEvent(in DOMString eventTypeArg, in boolean canBubbleArg, in boolean cancelableArg); ; PhaseType AT_TARGET EventTarget . BUBBLING_PHASE . CAPTURING_PHASE . boolean bubbles . true, false boolean cancelable