⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dom2.js

📁 《JavaScript王者归来》examples.rar
💻 JS
📖 第 1 页 / 共 2 页
字号:
'org.w3c.dom.DOMException' : '$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(){$class.$super.apply(this,arguments.length>0?arguments:["dom exception."]);}' ,
'org.w3c.dom.Document' : '$package("org.w3c.dom");var HashMap=$import("js.util.HashMap");var Node=$import("org.w3c.dom.Node");var $class=org.w3c.dom.Document=function(){return $Document.apply(this,arguments);};var Document=$class;$class.$extends(Node);var $Document=function(){$class.$super.call(this,Node.DOCUMENT_NODE);};var $p=Document.prototype;$p.getDoctype=function(){};$p.getImplementation=function(){};$p.getDocumentElement=function(){};$p.createElement=function(tagName){};$p.createTextNode=function(data){};$p.createAttribute=function(name){};$p.getElementsByTagName=function(tagName){};$p.getElementById=function(elementId){}' ,
'org.w3c.dom.Element' : '$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;};var $p=Element.prototype;$p.getTagName=function(){return this.__tagName;};$p.getAttribute=function(name){var atts=this.__attributes;return(atts==null||!atts.containsKey(name))?null:atts.get(name).getValue();};$p.setAttribute=function(name,value){var atts=this.__attributes;if(atts==null){atts=this.__attributes=new HashMap();};var attr=new Attr(name,value);attr.__ownerElement=this;return atts.put(name,attr);};$p.removeAttribute=function(name){var atts=this.__attributes;return(atts==null)?null:atts.remove(name);};$p.hasAttribute=function(name){var atts=this.__attributes;return(atts==null)?false:atts.containsKey(name);};$p.getAttributeNode=function(name){var atts=this.__attributes;return(atts==null)?null:atts.get(name);};$p.setAttributeNode=function(newAttr){var atts=this.__attributes;if(atts==null){atts=this.__attributes=new HashMap();};var name=newAttr.getName();var oldAttr=atts.get(name);if(oldAttr==newAttr){return oldAttr;};if(oldAttr!=null&&oldAttr.getOwnerElement()==this){oldAttr.__ownerElement=null;};atts.put(name,newAttr);newAttr.__ownerElement=this;return oldAttr;};$p.removeAttributeNode=function(oldAttr){var atts=this.__attributes;if(atts==null||!atts.containsValue(oldAttr)){throw new DOMException(this.getClass().getName()+".removeAttributeNode(oldAttr) error: "+"oldAttr is not an attribute of the element");};atts.remove(oldAttr.getName());if(oldAttr.getOwnerElement()==this){oldAttr.__ownerElement=null;};return oldAttr;}' ,
'org.w3c.dom.NamedNodeMap' : '$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();};var $p=NamedNodeMap.prototype;$p.getNamedItem=function(name){return this.__map.get(name);};$p.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);};$p.removeNamedItem=function(name){this.__map.remove(name);};$p.item=function(index){var entrys=this.__map.toArray();var entry=entrys[index];return(entry==null)?null:entry.getValue();};$p.getLength=function(){return this.__map.size();}' ,
'org.w3c.dom.Node' : '$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;};var $p=Node.prototype;$p.getNodeName=function(){return this.__nodeName;};$p.getNodeValue=function(){return this.__nodeValue;};$p.setNodeValue=function(value){this.__nodeValue=value;};$p.getNodeType=function(){return this.__nodeType;};$p.getParentNode=function(){return this.__parentNode;};$p.__setParentNode=function(oNode){this.__parentNode=oNode;};$p.getChildNodes=function(){return this.__childNodes.toArray();};$p.getFirstChild=function(){return this.__childNodes.get(0);};$p.getLastChild=function(){var cns=this.__childNodes;return cns.get(cns.size()-1);};$p.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;};$p.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;};$p.getAttributes=function(){if(this.__namedNodeMap==null){this.__namedNodeMap=Class.forName("org.w3c.dom.NamedNodeMap").newInstance();};return this.__namedNodeMap;};$p.getOwnerDocument=function(){return this.__ownerDocument;};$p.insertBefore=function(newChild,refChild){var cns=this.__childNodes;var index=cns.indexOf(refChild);if(index==-1){cns.add(newChild);}else{cns.add(index,newChild);};newChild.__parentNode=this;return newChild;};$p.replaceChild=function(newChild,oldChild){var cns=this.__childNodes;cns.remove(newChild);var index=cns.indexOf(oldChild);if(index==-1){throw new DOMException(this.getClass().getName()+".replaceChild(newChild, oldChild) error: oldChild does not exist.");};cns.add(index,newChild);cns.removeAt(index+1);oldChild.__parentNode=null;newChild.__parentNode=this;return oldChild;};$p.removeChild=function(oldChild){this.__childNodes.remove(oldChild);oldChild.__parentNode=null;return oldChild;};$p.appendChild=function(newChild){this.__childNodes.add(newChild);newChild.__parentNode=this;return newChild;};$p.hasChildNodes=function(){this.__childNodes.size()>0;};$p.cloneNode=function(deep){};$p.normalize=function(){};$p.isSupported=function(feature,version){return(feature=="1.0"&&version=="1.0")}\n$p.getNamespaceURI=function(){this.__namespaceURI;};$p.getPrefix=function(){return this.__prefix;};$p.setPrefix=function(prefix){this.__prefix=prefix;};$p.getLocalName=function(){return this.__localName;};$p.hasAttributes=function(){var nmap=this.__namedNodeMap;return(nmap!=null&&nmap.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' : '$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(){};var $p=DocumentEvent.prototype;$p.createEvent=function(sType){return new Event(sType);}' ,
'org.w3c.dom.events.Event' : '$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();};var $p=Event.prototype;$p.getType=function(){return this.type;};$p.getTarget=function(){return this.target;};$p.getCurrentTarget=function(){return this.currentTarget;};$p.getBubbles=function(){return this.bubbles;};$p.stopPropagation=function(){this.__propagationStopped=true;};$p.getPropagationStopped=function(){return this.__propagationStopped;};$p.getCancelable=function(){return this.cancelable;};$p.getEventPhase=function(){return this.__phase;};$p.getTimeStamp=function(){return this.__timestamp;};$p.preventDefault=function(){if(this.getCancelable()){this.__defaultPrevented=true;}};$p.getDefaultPrevented=function(){return this.__defaultPrevented;};$p.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' : '$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(){$class.$super.apply(this,arguments.length>0?arguments:["dom event exception."]);}' ,
'org.w3c.dom.events.EventListener' : '$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(fHandler,oOwner){this.handler=fHandler;this.owner=(oOwner!=null&&typeof(oOwner)=="object")?oOwner:null;};var $p=EventListener.prototype;$p.handleEvent=function(oEvt,async){var h=this.handler,o=(this.owner||this);var func=function(){return h.call(o,oEvt);};return(async==true)?setTimeout(func):func();}' ,
'org.w3c.dom.events.EventTarget' : '$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,async){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,async);};if(oEvt.getBubbles()&&!oEvt.getPropagationStopped()&&this.parent!=null){this.parent.dispatchEvent(oEvt,async);};return !oEvt.getDefaultPrevented();}}' ,
'org.w3c.dom.events.KeyboardEvent' : '$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;};var $p=KeyboardEvent.prototype;$p.getAltKey=function(){return this.event.altKey;};$p.getCtrlKey=function(){return this.event.ctrlKey;};$p.getShiftKey=function(){return this.event.shiftKey;};$p.getKeyCode=function(){return this.keyCode;};$p.preventDefault=function(){$class.$super.prototype.preventDefault.call(this);this.event.returnValue=false;if(System.isIeBrowser()){try{this.event.keyCode=0x0;}catch(ex){}}};$p.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' : '$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;};var $p=MouseEvent.prototype;$p.getAltKey=function(){return this.event.altKey;};$p.getCtrlKey=function(){return this.event.ctrlKey;};$p.getShiftKey=function(){return this.event.shiftKey;};$p.getButton=function(){return(System.isIeBrowser()&&this.event.type=="click")?1:this.event.button;};$p.getClientX=function(){return this.event.clientX;};$p.getClientY=function(){return this.event.clientY;};$p.getMetaKey=function(){throw new DOMException(MouseEvent.getName()+".getMetaKey() has not implemented.");};var isIE=System.isIeBrowser();$p.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;};$p.getScreenX=function(){return this.event.screenX;};$p.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' : '$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;};var $p=HTMLDocument.prototype;$p.getTitle=function(){return this.__title;};$p.setTitle=function(sTitle){this.__title=sTitle;};$p.getBody=function(){return this.__body;};$p.setBody=function(body){this.__body=body;};$p.getReferrer=function(){return this.__referrer;};$p.getDomain=function(){return this.__domain;};$p.getCookie=function(){};$p.setCookie=function(sValue){};$p.open=function(){this.dispatchEvent(new Event("open"));};$p.close=function(){this.dispatchEvent(new Event("close"));};$p.write=function(sText){};$p.writeln=function(sText){}' ,
'org.w3c.dom.html.HTMLElement' : '$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;};var $p=HTMLElement.prototype;$p.getId=function(){return "_he_"+this.getUniqueId();};$p.getClassName=function(){return this.__className;};$p.setClassName=function(className){this.__className=className;var entity=this.getEntity();if(entity!=null){entity.setAttribute("className",className);}};$p.insertBefore=function(newChild,refChild){$class.$super.prototype.insertBefore.call(this,newChild,refChild);newChild.parent=this;return newChild;};$p.replaceChild=function(newChild,oldChild){$class.$super.prototype.replaceChild.call(this,newChild,oldChild);oldChild.parent=null;newChild.parent=this;return oldChild;};$p.removeChild=function(oldChild){$class.$super.prototype.removeChild.call(this,oldChild);oldChild.__parentNode=null;return oldChild;};$p.appendChild=function(newChild){$class.$super.prototype.appendChild.call(this,newChild);newChild.parent=this;return newChild;};$p.getEntity=function(autoCreate){return(this.__entity==null&&autoCreate)?this.createEntity():this.__entity;};$p.build=function(elmt){elmt=elmt||document.body;if(!this.__builded){elmt.appendChild(this.getEntity(true));this.__builded=true;}};var __htmlTag="SPAN";$p.createEntity=function(tagName){try{var entity=this.__entity;if(entity==null){entity=this.__entity=document.createElement(tagName||__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);}};$p.destroy=function(){this.dispose();};$p.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;};$p.isVisible=function(){return(this.getEntity()&&this.getEntity().display=="");};$p.setVisible=function(b){var entity=this.getEntity();if(entity!=null){entity.style.display=b?"":"none";}};$p.show=function(){this.setVisible(true);};$p.hide=function(){this.setVisible(false);};$p.focus=function(){var entity=this.getEntity();if(entity!=null){entity.focus();}};$p.blur=function(){var entity=this.getEntity();if(entity!=null){entity.blur();}}' ,
'null':null
}});

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -