?? dom2.js
字號:
'org.w3c.dom.DOMException' : '(function(){_$package("org.w3c.dom");var RuntimeException=_$import("js.lang.RuntimeException");var $class=org.w3c.dom.DOMException=function(){return $DOMException.apply(this,arguments);};var DOMException=$class;$class.$extends(RuntimeException);var $DOMException=function(msg){if(msg==null){arguments=["dom exception."];};$class.$super.apply(this,arguments);}})();' ,
'org.w3c.dom.Element' : '(function(){_$package("org.w3c.dom");var HashMap=_$import("js.util.HashMap");var Node=_$import("org.w3c.dom.Node");var Attr=_$import("org.w3c.dom.Attr");var DOMException=_$import("org.w3c.dom.DOMException");var $class=org.w3c.dom.Element=function(){return $Element.apply(this,arguments);};var Element=$class;$class.$extends(Node);var $Element=function(sName){$class.$super.call(this,Node.ELEMENT_NODE,sName,null);this.__tagName=sName;this.__attributes=null;};Element.prototype.getTagName=function(){return this.__tagName;};Element.prototype.getAttribute=function(name){return(this.__attributes==null||!this.__attributes.containsKey(name))?null:this.__attributes.get(name).getValue();};Element.prototype.setAttribute=function(name,value){if(this.__attributes==null){this.__attributes=new HashMap();};var attr=new Attr(name,value);attr.__ownerElement=this;return this.__attributes.put(name,attr);};Element.prototype.removeAttribute=function(name){return(this.__attributes==null)?null:this.__attributes.remove(name);};Element.prototype.hasAttribute=function(name){return(this.__attributes==null)?false:this.__attributes.containsKey(name);};Element.prototype.getAttributeNode=function(name){if(this.__attributes==null){return null;};return this.__attributes.get(name);};Element.prototype.setAttributeNode=function(newAttr){if(this.__attributes==null){this.__attributes=new HashMap();};var name=newAttr.getName();var oldAttr=this.__attributes.get(name);if(oldAttr==newAttr){return oldAttr;};if(oldAttr!=null&&oldAttr.getOwnerElement()==this){oldAttr.__ownerElement=null;};this.__attributes.put(name,newAttr);newAttr.__ownerElement=this;return oldAttr;};Element.prototype.removeAttributeNode=function(oldAttr){if(this.__attributes==null||!this.__attributes.containsValue(oldAttr)){throw new DOMException(this.getClass().getName()+".removeAttributeNode(oldAttr) error: "+"oldAttr is not an attribute of the element");};this.__attributes.remove(oldAttr.getName());if(oldAttr.getOwnerElement()==this){oldAttr.__ownerElement=null;};return oldAttr;}})();' ,
'org.w3c.dom.NamedNodeMap' : '(function(){_$package("org.w3c.dom");var HashMap=_$import("js.util.HashMap");var Node=_$import("org.w3c.dom.Node");var $class=org.w3c.dom.NamedNodeMap=function(){return $NamedNodeMap.apply(this,arguments);};var NamedNodeMap=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $NamedNodeMap=function(){this.__map=new HashMap();};NamedNodeMap.prototype.getNamedItem=function(name){return this.__map.get(name);};NamedNodeMap.prototype.setNamedItem=function(name,node){if(!(node instanceof Node)){throw new ArgumentException(this.getClass().getName()+".setNamedItem(name, node) error: argument node is not an instance of Node.");};this.__map.put(name,node);};NamedNodeMap.prototype.removeNamedItem=function(name){this.__map.remove(name);};NamedNodeMap.prototype.item=function(index){var entrys=this.__map.toArray();var entry=entrys[index];return(entry==null)?null:entry.getValue();};NamedNodeMap.prototype.getLength=function(){return this.__map.size();}})();' ,
'org.w3c.dom.Node' : '(function(){_$package("org.w3c.dom");var BObject=_$import("js.lang.BObject");var ArrayList=_$import("js.util.ArrayList");var DOMException=_$import("org.w3c.dom.DOMException");var $class=org.w3c.dom.Node=function(){return $Node.apply(this,arguments);};var Node=$class;$class.$extends(BObject);var $Node=function(sType,sName,vValue){$class.$super.call(this);this.__nodeType=sType||Node.ELEMENT_NODE;this.__nodeName=sName||null;this.__nodeValue=vValue||null;this.__namedNodeMap=null;this.__parentNode=null;this.__childNodes=new ArrayList();;this.__ownerDocument=null;this.__namespaceURI=null;this.__prefix="";this.__localName=null;};Node.prototype.getNodeName=function(){return this.__nodeName;};Node.prototype.getNodeValue=function(){return this.__nodeValue;};Node.prototype.setNodeValue=function(value){this.__nodeValue=value;};Node.prototype.getNodeType=function(){return this.__nodeType;};Node.prototype.getParentNode=function(){return this.__parentNode;};Node.prototype.__setParentNode=function(oNode){this.__parentNode=oNode;};Node.prototype.getChildNodes=function(){return this.__childNodes.toArray();};Node.prototype.getFirstChild=function(){return this.__childNodes.get(0);};Node.prototype.getLastChild=function(){return this.__childNodes.get(this.__childNodes.size()-1);};Node.prototype.getPreviousSibling=function(){var parentNode=this.getParentNode();if(parentNode!=null){var children=parentNode.getChildNodes();var len=children.length;for(var i=0;i<len;i++){if(children[i]==this&&i>1){return children[i-1];}}};return null;};Node.prototype.getNextSibling=function(){var parentNode=this.getParentNode();if(parentNode!=null){var children=parentNode.getChildNodes();var len=children.length;for(var i=0;i<len;i++){if(children[i]==this&&i<(len-1)){return children[i+1];}}};return null;};Node.prototype.getAttributes=function(){if(this.__namedNodeMap==null){this.__namedNodeMap=Class.forName("org.w3c.dom.NamedNodeMap").newInstance();};return this.__namedNodeMap;};Node.prototype.getOwnerDocument=function(){return this.__ownerDocument;};Node.prototype.insertBefore=function(newChild,refChild){var index=this.__childNodes.indexOf(refChild);if(index==-1){this.__childNodes.add(newChild);}else{this.__childNodes.add(index,newChild);};newChild.__parentNode=this;return newChild;};Node.prototype.replaceChild=function(newChild,oldChild){this.__childNodes.remove(newChild);var index=this.__childNodes.indexOf(oldChild);if(index==-1){throw new DOMException(this.getClass().getName()+".replaceChild(newChild, oldChild) error: oldChild does not exist.");};this.__childNodes.add(index,newChild);this.__childNodes.removeAt(index+1);oldChild.__parentNode=null;newChild.__parentNode=this;return oldChild;};Node.prototype.removeChild=function(oldChild){this.__childNodes.remove(oldChild);oldChild.__parentNode=null;return oldChild;};Node.prototype.appendChild=function(newChild){this.__childNodes.add(newChild);newChild.__parentNode=this;return newChild;};Node.prototype.hasChildNodes=function(){this.__childNodes.size()>0;};Node.prototype.cloneNode=function(deep){};Node.prototype.normalize=function(){};Node.prototype.isSupported=function(feature,version){return(feature=="1.0"&&version=="1.0")}\nNode.prototype.getNamespaceURI=function(){this.__namespaceURI;};Node.prototype.getPrefix=function(){return this.__prefix;};Node.prototype.setPrefix=function(prefix){this.__prefix=prefix;};Node.prototype.getLocalName=function(){return this.__localName;};Node.prototype.hasAttributes=function(){return(this.__nameNodeMap.getLength()>0);};Node.ELEMENT_NODE=1;Node.ATTRIBUTE_NODE=2;Node.TEXT_NODE=3;Node.CDATA_SECTION_NODE=4;Node.ENTITY_REFERENCE_NODE=5;Node.ENTITY_NODE=6;Node.PROCESSING_INSTRUCTION_NODE=7;Node.COMMENT_NODE=8;Node.DOCUMENT_NODE=9;Node.DOCUMENT_TYPE_NODE=10;Node.DOCUMENT_FRAGMENT_NODE=11;Node.NOTATION_NODE=12;})();' ,
'org.w3c.dom.events.DocumentEvent' : '(function(){_$package("org.w3c.dom.events");var BObject=_$import("js.lang.BObject");var HashMap=_$import("js.util.HashMap");var DOMException=_$import("org.w3c.dom.DOMException");var Event=_$import("org.w3c.dom.events.Event");var $class=org.w3c.dom.events.DocumentEvent=function(){return $DocumentEvent.apply(this,arguments);};var DocumentEvent=$class;$class.$extends(Event);var $DocumentEvent=function(){};DocumentEvent.prototype.createEvent=function(sType){return new Event(sType);}})();' ,
'org.w3c.dom.events.Event' : '(function(){_$package("org.w3c.dom.events");var $class=org.w3c.dom.events.Event=function(){return $Event.apply(this,arguments);};var Event=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $Event=function(sType){this.type=sType||"Event";this.target=null;this.currentTarget=null;this.bubbles=true;this.__defaultPrevented=false;this.cancelable=true;this.__propagationStopped=false;this.__phase=Event.CAPTURING_PHASE;this.__timestamp=new Date().getTime();};Event.prototype.getType=function(){return this.type;};Event.prototype.getTarget=function(){return this.target;};Event.prototype.getCurrentTarget=function(){return this.currentTarget;};Event.prototype.getBubbles=function(){return this.bubbles;};Event.prototype.stopPropagation=function(){this.__propagationStopped=true;};Event.prototype.getPropagationStopped=function(){return this.__propagationStopped;};Event.prototype.getCancelable=function(){return this.cancelable;};Event.prototype.getEventPhase=function(){return this.__phase;};Event.prototype.getTimeStamp=function(){return this.__timestamp;};Event.prototype.preventDefault=function(){if(this.getCancelable()){this.__defaultPrevented=true;}};Event.prototype.getDefaultPrevented=function(){return this.__defaultPrevented;};Event.prototype.initEvent=function(sType,bBubbles,bCancelable){this.type=sType;this.bubbles=bBubbles;this.cancelable=bCancelable;};Event.CAPTURING_PHASE=1;Event.AT_TARGET=2;Event.BUBBLING_PHASE=3;})();' ,
'org.w3c.dom.events.EventException' : '(function(){_$package("org.w3c.dom.events");var DOMException=_$import("org.w3c.dom.DOMException");var $class=org.w3c.dom.events.EventException=function(){return $EventException.apply(this,arguments);};var EventException=$class;$class.$extends(DOMException);var $EventException=function(msg){if(msg==null){arguments=["xdom event exception."];};$class.$super.apply(this,arguments);}})();' ,
'org.w3c.dom.events.EventListener' : '(function(){_$package("org.w3c.dom.events");var $class=org.w3c.dom.events.EventListener=function(){return $EventListener.apply(this,arguments);};var EventListener=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $EventListener=function(fHandle,oOwner){this.handle=fHandle;this.owner=(oOwner!=null&&typeof(oOwner)=="object")?oOwner:null;};EventListener.prototype.handleEvent=function(oEvt){var h=this.handle;var o=this.owner||this;h.call(o,oEvt);}})();' ,
'org.w3c.dom.events.EventTarget' : '(function(){_$package("org.w3c.dom.events");var JObject=_$import("js.lang.JObject");var ArgumentException=_$import("js.lang.ArgumentException");var HashMap=_$import("js.util.HashMap");var Event=_$import("org.w3c.dom.events.Event");var EventListener=_$import("org.w3c.dom.events.EventListener");var EventException=_$import("org.w3c.dom.events.EventException");var $class=org.w3c.dom.events.EventTarget=function(){return $EventTarget.apply(this,arguments);};var EventTarget=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $EventTarget=function(){this.parent=null;var listeners=new HashMap();this.addEventListener=function(sType,oListener,bUseCapture){if(!(oListener instanceof EventListener)){throw new ArgumentException(this.getClass().getName()+".addEventListener(sType, oListener, bUseCapture) error: "+"argument oListener is not an instance of EventListener.");};bUseCapture=(bUseCapture==true);var listenerMap=listeners.get(sType);if(listenerMap==null){listeners.put(sType,(listenerMap=new HashMap()));};listenerMap.put(oListener,oListener);};this.removeEventListener=function(sType,oListener,bUseCapture){bUseCapture=(bUseCapture==true);var listenerMap=listeners.get(sType);if(listenerMap!=null){listenerMap.remove(oListener);}};this.dispatchEvent=function(oEvt){if(oEvt.getTarget()==null){oEvt.target=this;};oEvt.currentTarget=this;var listenerMap=listeners.get(oEvt.getType());if(listenerMap==null){return;};var iterator=listenerMap.elements();while(iterator.hasNext()){iterator.next().handleEvent(oEvt);};if(oEvt.getBubbles()&&!oEvt.getPropagationStopped()&&this.parent!=null){this.parent.dispatchEvent(oEvt);};return !oEvt.getDefaultPrevented();}}})();' ,
'org.w3c.dom.events.KeyboardEvent' : '(function(){_$package("org.w3c.dom.events");var Event=_$import("org.w3c.dom.events.Event");var $class=org.w3c.dom.events.KeyboardEvent=function(){return $KeyboardEvent.apply(this,arguments);};var KeyboardEvent=$class;$class.$extends(Event);var $KeyboardEvent=function(sType,oEvt){$class.$super.call(this,sType);this.event=oEvt;this.keyCode=oEvt.keyCode||oEvt.charCode;};KeyboardEvent.prototype.getAltKey=function(){return this.event.altKey;};KeyboardEvent.prototype.getCtrlKey=function(){return this.event.ctrlKey;};KeyboardEvent.prototype.getShiftKey=function(){return this.event.shiftKey;};KeyboardEvent.prototype.getKeyCode=function(){return this.keyCode;};KeyboardEvent.prototype.preventDefault=function(){$class.$super.prototype.preventDefault.call(this);this.event.returnValue=false;if(System.isIeBrowser()){try{this.event.keyCode=0x0;}catch(ex){}}};KeyboardEvent.prototype.dispose=function(){BiEvent.prototype.dispose.call(this);this.event=null;this.keyCode=0x0;};KeyboardEvent.KEYCODE_BACKSPACE=8;KeyboardEvent.KEYCODE_TAB=9;KeyboardEvent.KEYCODE_ENTER=13;KeyboardEvent.KEYCODE_SHIFT=16;KeyboardEvent.KEYCODE_CTRL=17;KeyboardEvent.KEYCODE_ALT=18;KeyboardEvent.KEYCODE_ESC=27;KeyboardEvent.KEYCODE_SPACE=32;KeyboardEvent.KEYCODE_LEFT=37;KeyboardEvent.KEYCODE_UP=38;KeyboardEvent.KEYCODE_RIGHT=39;KeyboardEvent.KEYCODE_DOWN=40;KeyboardEvent.KEYCODE_INSERT=45;KeyboardEvent.KEYCODE_DELETE=46;KeyboardEvent.KEYCODE_PAGEUP=33;KeyboardEvent.KEYCODE_PAGEDOWN=34;KeyboardEvent.KEYCODE_END=35;KeyboardEvent.KEYCODE_HOME=36;KeyboardEvent.KEYCODE_NUMPAD_0=96;KeyboardEvent.KEYCODE_NUMPAD_1=97;KeyboardEvent.KEYCODE_NUMPAD_2=98;KeyboardEvent.KEYCODE_NUMPAD_3=99;KeyboardEvent.KEYCODE_NUMPAD_4=100;KeyboardEvent.KEYCODE_NUMPAD_5=101;KeyboardEvent.KEYCODE_NUMPAD_6=102;KeyboardEvent.KEYCODE_NUMPAD_7=103;KeyboardEvent.KEYCODE_NUMPAD_8=104;KeyboardEvent.KEYCODE_NUMPAD_9=105;KeyboardEvent.KEYCODE_NUMPAD_MULTIPLY=106;KeyboardEvent.KEYCODE_NUMPAD_PLUS=107;KeyboardEvent.KEYCODE_NUMPAD_MINUS=109;KeyboardEvent.KEYCODE_NUMPAD_DIVIDE=111;KeyboardEvent.KEYCODE_F1=112;KeyboardEvent.KEYCODE_F2=113;KeyboardEvent.KEYCODE_F3=114;KeyboardEvent.KEYCODE_F4=115;KeyboardEvent.KEYCODE_F5=116;KeyboardEvent.KEYCODE_F6=117;KeyboardEvent.KEYCODE_F7=118;KeyboardEvent.KEYCODE_F8=119;KeyboardEvent.KEYCODE_F9=120;KeyboardEvent.KEYCODE_F10=121;KeyboardEvent.KEYCODE_F11=122;KeyboardEvent.KEYCODE_F12=123;KeyboardEvent.KEYCODE_NUM_LOCK=144;})();' ,
'org.w3c.dom.events.MouseEvent' : '(function(){_$package("org.w3c.dom.events");var System=_$import("js.lang.System");var DOMException=_$import("org.w3c.dom.DOMException");var Event=_$import("org.w3c.dom.events.Event");var $class=org.w3c.dom.events.MouseEvent=function(){return $MouseEvent.apply(this,arguments);};var MouseEvent=$class;$class.$extends(Event);var $MouseEvent=function(sType,oEvt){$class.$super.call(this,sType);this.event=oEvt;};MouseEvent.prototype.getAltKey=function(){return this.event.altKey;};MouseEvent.prototype.getCtrlKey=function(){return this.event.ctrlKey;};MouseEvent.prototype.getShiftKey=function(){return this.event.shiftKey;};MouseEvent.prototype.getButton=function(){return(System.isIeBrowser()&&this.event.type=="click")?1:this.event.button;};MouseEvent.prototype.getClientX=function(){return this.event.clientX;};MouseEvent.prototype.getClientY=function(){return this.event.clientY;};MouseEvent.prototype.getMetaKey=function(){throw new DOMException(MouseEvent.getName()+".getMetaKey() has not implemented.");};var isIE=System.isIeBrowser();MouseEvent.prototype.getRelatedTarget=function(){var relEl=null;if(isIE){if(this.event.type=="mouseover"){relEl=this.event.fromElement;}else if(this.type=="mouseout"){relEl=this.event.toElement;}else{relEl=this.event.srcElement;}}else{relEl=this.event.relatedTarget;};try{while(relEl!=null&&relEl.referenceObject==null){relEl=relEl.parentNode;}}catch(ex){return null;};return(relEl==null)?null:relEl.referenceObject;};MouseEvent.prototype.getScreenX=function(){return this.event.screenX;};MouseEvent.prototype.getScreenY=function(){return this.event.screenY;};MouseEvent.BTN_LEFT=isIE?1:0;MouseEvent.BTN_RIGHT=isIE?2:1;MouseEvent.BTN_MIDDLE=isIE?4:2;})();' ,
'org.w3c.dom.html.HTMLDocument' : '(function(){_$package("org.w3c.dom.html");var HashMap=_$import("js.util.HashMap");var Document=_$import("org.w3c.dom.Document");var EventTarget=_$import("org.w3c.dom.events.EventTarget");var Event=_$import("org.w3c.dom.events.Event");var $class=org.w3c.dom.html.HTMLDocument=function(){return $HTMLDocument.apply(this,arguments);};var HTMLDocument=$class;$class.$extends(Document);var $HTMLDocument=function(){$class.$super.call(this);EventTarget.call(this);this.__title=null;this.__domain=null;this.__referrer=null;this.__body=null;};HTMLDocument.prototype.getTitle=function(){return this.__title;};HTMLDocument.prototype.setTitle=function(sTitle){this.__title=sTitle;};HTMLDocument.prototype.getBody=function(){return this.__body;};HTMLDocument.prototype.setBody=function(body){this.__body=body;};HTMLDocument.prototype.getReferrer=function(){return this.__referrer;};HTMLDocument.prototype.getDomain=function(){return this.__domain;};HTMLDocument.prototype.getCookie=function(){};HTMLDocument.prototype.setCookie=function(sValue){};HTMLDocument.prototype.open=function(){this.dispatchEvent(new Event("open"));};HTMLDocument.prototype.close=function(){this.dispatchEvent(new Event("close"));};HTMLDocument.prototype.write=function(sText){};HTMLDocument.prototype.writeln=function(sText){}})();' ,
'org.w3c.dom.html.HTMLElement' : '(function(){_$package("org.w3c.dom.html");var DOMException=_$import("org.w3c.dom.DOMException");var EventTarget=_$import("org.w3c.dom.events.EventTarget");var Element=_$import("org.w3c.dom.Element");var $class=org.w3c.dom.html.HTMLElement=function(){return $HTMLElement.apply(this,arguments);};var HTMLElement=$class;$class.$extends(Element);var $HTMLElement=function(tagName){$class.$super.call(this,tagName);EventTarget.call(this);this.globalize();this.__entity=null;this.__className="";this.__builded=false;};HTMLElement.prototype.getId=function(){return "_he_"+this.getUniqueId();};HTMLElement.prototype.getClassName=function(){return this.__className;};HTMLElement.prototype.setClassName=function(className){this.__className=className;var entity=this.getEntity();if(entity!=null){entity.setAttribute("className",className);}};HTMLElement.prototype.insertBefore=function(newChild,refChild){$class.$super.prototype.insertBefore.call(this,newChild,refChild);newChild.parent=this;return newChild;};HTMLElement.prototype.replaceChild=function(newChild,oldChild){$class.$super.prototype.replaceChild.call(this,newChild,oldChild);oldChild.parent=null;newChild.parent=this;return oldChild;};HTMLElement.prototype.removeChild=function(oldChild){$class.$super.prototype.removeChild.call(this,oldChild);oldChild.__parentNode=null;return oldChild;};HTMLElement.prototype.appendChild=function(newChild){$class.$super.prototype.appendChild.call(this,newChild);newChild.parent=this;return newChild;};HTMLElement.prototype.getEntity=function(autoCreate){return(this.__entity==null&&autoCreate)?this.createEntity():this.__entity;};HTMLElement.prototype.build=function(elmt){elmt=elmt||document.body;if(!this.__builded){elmt.appendChild(this.getEntity(true));this.__builded=true;}};var __htmlTag="SPAN";HTMLElement.prototype.createEntity=function(){try{var entity=this.__entity;if(entity==null){entity=this.__entity=document.createElement(__htmlTag);entity.setAttribute("id",this.getId());entity.setAttribute("ownerHTMLElement",this);entity.setAttribute("classType",this.getClass().getName());entity.setAttribute("className",this.getClassName());};return entity;}catch(ex){throw new DOMException(this.getClass().getName()+".createEntity() error.",ex);}};HTMLElement.prototype.destroy=function(){var entity=this.__entity;if(entity!=null){entity.removeAttribute("ownerHTMLElement");if(entity.parentNode!=null){entity.parentNode.removeChild(entity);};this.__entity=null;};this.__builded=false;};HTMLElement.prototype.dispose=function(){var nodes=this.getChildNodes();for(var i=0;i<nodes.length;i++){nodes[i].dispose();};var entity=this.__entity;if(entity!=null){entity.removeAttribute("ownerHTMLElement");if(entity.parentNode!=null){entity.parentNode.removeChild(entity);};this.__entity=null;};this.__builded=false;};HTMLElement.prototype.isVisible=function(){return(this.getEntity()&&this.getEntity().display=="");};HTMLElement.prototype.setVisible=function(b){var entity=this.getEntity();if(entity!=null){entity.style.display=b?"":"none";}};HTMLElement.prototype.show=function(){this.setVisible(true);};HTMLElement.prototype.hide=function(){this.setVisible(false);};HTMLElement.prototype.focus=function(){var entity=this.getEntity();if(entity!=null){entity.focus();}};HTMLElement.prototype.blur=function(){var entity=this.getEntity();if(entity!=null){entity.blur();}}})();' ,
'null' : null
};
});
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -