js权威指南-第六章

本文深入探讨JavaScript中的对象概念,包括创建对象的各种方法、属性的操作、继承机制、属性的特性及对象的锁定等高级主题。

第六章–对象

6.1 创建对象
三种方法

6.1.1 对象直接量
    对象直接量就相当于使用键值对进行对象的属性配置,类似与 json。
var empty={};//没有任何属性的对象
var point={x:2,y=0};//两个属性
......
6.1.2 通过new 创建对象

6.1.3 原型
    所有对象直列量创建的对象都具有同一个原型对象,并且通过 js代码 Object.prototype 获得对原型对象的引用。通过关键字 new 创建出来的对象的原型就是构造函数的 prototype 属性的值。
    没有原型的对象并不多, Object.prototype 就是其中之一。

6.1.4 Object.create()
    另有一个 Object.create()的方法。他创建一个对象,其中第一个对象是这个对象的原型。他提供了第二个可选参数,用以对这个对象的属性进行进一步描述。
    这是一个静态方法。
var o1=Object.create({s:1,j:6});//o1继承了属性s和j
var o2=Object.create(null); //o2 不继承任何属性和方法,甚至不含toString ,所以不可以和 ’+‘ 运算符一起工作

例6-1:通过原型继承创建一个新对象

function inherit(p){
    if(p==null)
        throw TypeError();//p 是一个对象,但不能为空
    if(Object.create)
        return Object.create(p);//直接使用它
    var t=typeof p;//否则进行进一步检测
    if(t!=="Object"&&t!=="funcrtion")
        throw TypeError();
    function f(){};//定义一个空的构造函数
    f.prototype=p;//讲其原型设定为p
    return new f(); //使用f创建p的继承对象
}

inherit函数的其中一个用途就是防止库函数无意间修改那些不受你控制的对象。不是讲对象作为参数传递给函数,而是将他的继承对象传入。当函数读取继承对象的属性进行修改时,实际上修改的只是这个继承对象本身,而不是原始对象。

6.2 属性的查询和设置
之前说过通过点(.) 或者 方括号([ ]) 可以获取属性的值。
和查询属性一样,也可以通过相同方式为对象设置属性赋值。

book.edition=6;//未book创建一个名为 edition的属性。
boook["main title"]="ECMAScript";//"main title"属性赋值
6.2.1 作为关联数组的对象
    上文说到,下面有个js表达式的值相同
object.property;
object["property"]
第二种语法更像是数组,只是这个数组元素是通过字符串索引而不是通过数字索引。这种数组就是我们说的关联数组。js对象都是关联数组。
当通过点操作符来操作属性时,属性名必须是一个标示符。标示符必须直接出现在 js 程序中。他们不是数据类型,程序无法修改他们。
当通过[] 来访问对象属性时,属性名字通过字符串表示。字符串是js数据类型,可以再运行时修改他们,因此可以使用如下代码
var addr="";
for(i=0;i<5;i++){
    addr+=consumer["address"+i];
}
6.2.2 继承

6.2.3 属性访问错误
    属性访问并不总是返回或设置一个值。
    查询一个不存在的属性并不会报错,如果在对象o之中的自身属性或者继承属性都没有找到指定属性,则讲返回 undefined 
    但是如果查询一个不存在对象的属性就会报错。
    另外有一些属性是只读的,不能别重新赋值。但是这些操作都不会报错。比如对 object.prototype 赋值不会成功而且不会报错。

6.3 删除属性
delete 操作符可以删除对象的属性。
注意 delete 只是断开对象与属性之间的关系。而不会去操作属性中的属性。
而且delete只能删除自身的属性,不能删除继承来的属性。
当删除成功或者没有任何副作用(删除不存在的属性)会返回 true。

o={x:1};
delete o.x; //删除x 返回true
delete o.x; //x已经不存在了,返回true
delete o.toString; // toSting 是继承而来的,什么也没有做,返回 true
delete 1; //无意义
delete 不能删除那些可配置性为 false 的属性。比如通过变量声明的或者函数声明的全局变量。这些情况下 delete 会返回 false
delete object.prototype;//不能删除,该属性不可配置
var x=1;//声明一个全局变量
delete this.x;//不能删除这个属性
function f(){};//声明一个全局函数
delete this.f;//也不能删除全局函数

6.4 检测属性
js可以视为属性的集。我们可以使用 in操作符,hasOwnProperty,propertyIsEnumerable 方法检测。
in 操作符左边是属性名,右边是一个对象。如果这个对象的自有属性或者继承属性包含这个属性,就返回 true。

var o={x:1};
"x" in o;//true
"y" in o;//false
"toString" in o;//true
对象的 hasOwnProperty 方法用来检测给定的名字是否是对象的自有属性。对于继承而来的属性会返回 false
var o={x:1};
o.hasOwnProperty("x");//true
o.hasOwnProperty("y");//false
o.hasOwnProperty("toString");//false
propertyIsEnumerable() 只有在检测到是自有属性而且是可枚举的才能返回 true
var o=inherit({y:2});
o.x=1;
o.propertyIsEnumerable("x");//true
o.propertyIsEnumerable("y");//false
o.propertyIsEnumerable("toString");//false .可以枚举

除了in操作符之外,还有一种更加简洁的方法来判断属性是否是 undefined。

var o={x:2};
o.x!==undefined;//true
o.y!==undefined;//false,没有这个属性
0.toString!==undefined;//true

值得注意的是 in可以区分属性存在但是值为 undefined的属性。!==操作符可能检测存在但是其值为 undefined的属性

6.5 枚举属性

6.6 属性 setter 和 gettter
定义储存器属性最简单的是使用对象直接量语法的一种扩展。

举个栗子:

var p={
    x:1.0,
    y:2.0,
    get r(){
        return Math.sqrt(this.x*this.x+this.y*this.y);
    },
    set r(newvalue){
        var oldvalue=Math.sqrt(this.x*this.x+this.y*this.y);
        var ratio=newvalue/oldvaluxe;
        this.x*=ratio;
        this.y*=ratio;
    },
    get theta(){
        return Math.atan2(this.y,this.x);
    }
};
这里函数定义没有使用 function 的关键字,而是使用 get set。而且函数自检没有使用分好分开,而是使用逗号分隔。属性也是如此。

6.7 属性的特性
可以认为一个属性包括四个特性,读取,写入,可枚举,可配置。
通过调用 Object.getOwnPropertyDescriptor() 获取某个对象特定属性的属性描述符。

//返回 {value:2,writable:true,enumerable:true,configrable:true}
Object.getOwnPropertyDescriptor({x:2,"x"});
//返回 {get:/*fun*/,set:undfined,enumerable:true,configurable:true}
Object.getOwnPropertyDescriptor(random,"octet");
//对于不存在或是继承而来的属性,将返回 undefined
Object.getOwnPropertyDescriptor({},"x");
Object.getOwnPropertyDescriptor({},"toString");
想要设置属性的特性,或者想让新建舒心具有某种特性,则需要调用 Object.defineproperty(),传入想要修改的对象、要创建或者修改的属性的名称以及属性描述符对象
var o={};
//添加不可枚举的数据属性,并赋值为1
Object.defineProperty(o,"x",{value:1,writable:true,enumerable:false,configurable:true});
//修改为只读
Object.defineProperty(o,"x",{writable:false});
//操作失败但是不会报错
o.x=2;
  • 如果对象是不可扩展的,那么可以编辑已有的自由属性,但是不能给他添加新属性
  • 如果属性时不可配置的,那么不能修改它的可配置性和可枚举性。
  • 如果存储器属性是不可配置的,则不能修改其 getter setter 方法,也不能将其转换成数据属性
  • 如果数据属性是不可配置的,则不能将它转化为存储器属性
  • 如果数据属性是不可配置的,则不能将他的可写性从false修改为true,但是可以从 true修改为 false
  • 如果数据属性是不可配置的且不可写的,则不能修改他的值。然而可配置的但是不可写的值可以修改。
//给Object.propertype 添加一个不可枚举的extend方法
//这个方法继承自调用他的对象,将作为参数传入的对象的属性一一复制
//除了值之外,也复制属性的所有特性,除非在目标对象中存在同名的属性,
//参数对象的所有自有对象(包括不可枚举的属性),也会一一复制
 Object.defineProperty(Object.property,"extend",{
    writable:true,//定义 Object.prototype.extend
    enumerable:false,//定义不可枚举
    configuration:true,
    value: function(o){
        //得到所有的自有属性,包括不可枚举属性
        var names=Object.getOwnPropertyNames(o);
        for(var i=0;i<names.length;i++){
            //如果属性已经存在 跳过
            if(names[i] in this) continue;
            //得到o中的属性的描述符
            var desc=Object.getOwnPropertyDescriptor(o,names[i]);
            //用他给this创建一个属性
            Object.defineProperty(this,names[i],desc);
        }

    }
});

6.8 对象的三个属性
6.8.1 原型属性
6.8.2 类属性
对象的类属性是一个字符串,用以表示对象的类型信息。
默认的 toString 方法返回如下格式字符串:
[object class]
所以想要获得对象的类,可以调用对象的 toString 方法。然后提取仪返回字符串的第8个字符到倒数第二个位置之间的字符。
classof() 函数可以返回传递给他的任意对象的类

function classof(o){
    if(o=null) return "Null";
    if(o=undefined) return "Undefined";
    return Object.prototype.toString.call(o).slice(8,-1);
}
6.8.3 可扩展性
    对象的可扩展性用以表示是否可以对对象添加新属性。
    可扩展性的目的是将对象锁定,以避免外界的干扰。
    Object.seal() 和 Object.preventExtensions() 类似。除了给对象位置为不可扩展之外,还可以将对象的所有自身属性都设置为不可配置的。也就是说不能给这个对象添加新对象,而且他已有的属性也不可以删除或配置,不过可写属性依然可以设置。注意对于那些已经封闭起来的对象是不能解封的,可以使用 Object.isSealed()来检测对象是否封闭。
    Object.freeze() 将更严格地锁定对象,除了将对象设置为不可扩展和将其属性设置为不可配置之外,还可以将它自由属性设置为只读的。使用 Object.isFrozen() 查询对象是否冻结。
var o=Object.seal(Object.create(Object.freeze({x:1}),{}));
JavaScript权威指南 犀牛书 Chapter 1. Introduction to JavaScript Section 1.1. JavaScript Myths Section 1.2. Versions of JavaScript Section 1.3. Client-Side JavaScript Section 1.4. JavaScript in Other Contexts Section 1.5. Client-Side JavaScript: Executable Content in Web Pages Section 1.6. Client-Side JavaScript Features Section 1.7. JavaScript Security Section 1.8. Example: Computing Loan Payments with JavaScript Section 1.9. Using the Rest of This Book Section 1.10. Exploring JavaScript Part I: Core JavaScript Chapter 2. Lexical Structure Section 2.1. Character Set Section 2.2. Case Sensitivity Section 2.3. Whitespace and Line Breaks Section 2.4. Optional Semicolons Section 2.5. Comments Section 2.6. Literals Section 2.7. Identifiers Section 2.8. Reserved Words Chapter 3. Data Types and Values Section 3.1. Numbers Section 3.2. Strings Section 3.3. Boolean Values Section 3.4. Functions Section 3.5. Objects Section 3.6. Arrays Section 3.7. null Section 3.8. undefined Section 3.9. The Date Object Section 3.10. Regular Expressions Section 3.11. Error Objects Section 3.12. Primitive Data Type Wrapper Objects Chapter 4. Variables Section 4.1. Variable Typing Section 4.2. Variable Declaration Section 4.3. Variable Scope Section 4.4. Primitive Types and Reference Types Section 4.5. Garbage Collection Section 4.6. Variables as Properties Section 4.7. Variable Scope Revisited Chapter 5. Expressions and Operators Section 5.1. Expressions Section 5.2. Operator Overview Section 5.3. Arithmetic Operators Section 5.4. Equality Operators Section 5.5. Relational Operators Section 5.6. String Operators Section 5.7. Logical Operators Section 5.8. Bitwise Operators Section 5.9. Assignment Operators Section 5.10. Miscellaneous Operators Chapter 6. Statements Section 6.1. Expression Statements Section 6.2. Compound Statements Section 6.3. if Section 6.4. else if Section 6.5. switch Section 6.6. while Section 6.7. do/while Section 6.8. for Section 6.9. for/in Section 6.10. Labels Section 6.11. break Section 6.12. continue Section 6.13. var Section 6.14. function Section 6.15. return Section 6.16. throw Section 6.17. try/catch/finally Section 6.18. with Section 6.19. The Empty Statement Section 6.20. Summary of JavaScript Statements Chapter 7. Functions Section 7.1. Defining and Invoking Functions Section 7.2. Functions as Data Section 7.3. Function Scope: The Call Object Section 7.4. Function Arguments: The Arguments Object Section 7.5. Function Properties and Methods Chapter 8. Objects Section 8.1. Objects and Properties Section 8.2. Constructors Section 8.3. Methods Section 8.4. Prototypes and Inheritance Section 8.5. Object-Oriented JavaScript Section 8.6. Objects as Associative Arrays Section 8.7. Object Properties and Methods Chapter 9. Arrays Section 9.1. Arrays and Array Elements Section 9.2. Array Methods Chapter 10. Pattern Matching with Regular Expressions Section 10.1. Defining Regular Expressions Section 10.2. String Methods for Pattern Matching Section 10.3. The RegExp Object Chapter 11. Further Topics in JavaScript Section 11.1. Data Type Conversion Section 11.2. By Value Versus by Reference Section 11.3. Garbage Collection Section 11.4. Lexical Scoping and Nested Functions Section 11.5. The Function( ) Constructor and Function Literals Section 11.6. Netscape's JavaScript 1.2 Incompatibilities Part II: Client-Side JavaScript Chapter 12. JavaScript in Web Browsers Section 12.1. The Web Browser Environment Section 12.2. Embedding JavaScript in HTML Section 12.3. Execution of JavaScript Programs Chapter 13. Windows and Frames Section 13.1. Window Overview Section 13.2. Simple Dialog Boxes Section 13.3. The Status Line Section 13.4. Timeouts and Intervals Section 13.5. Error Handling Section 13.6. The Navigator Object Section 13.7. The Screen Object Section 13.8. Window Control Methods Section 13.9. The Location Object Section 13.10. The History Object Section 13.11. Multiple Windows and Frames Chapter 14. The Document Object Section 14.1. Document Overview Section 14.2. Dynamically Generated Documents Section 14.3. Document Color Properties Section 14.4. Document Information Properties Section 14.5. Forms Section 14.6. Images Section 14.7. Links Section 14.8. Anchors Section 14.9. Applets Section 14.10. Embedded Data Chapter 15. Forms and Form Elements Section 15.1. The Form Object Section 15.2. Defining Form Elements Section 15.3. Scripting Form Elements Section 15.4. Form Verification Example Chapter 16. Scripting Cookies Section 16.1. An Overview of Cookies Section 16.2. Storing Cookies Section 16.3. Reading Cookies Section 16.4. Cookie Example Chapter 17. The Document Object Model Section 17.1. An Overview of the DOM Section 17.2. Using the Core DOM API Section 17.3. DOM Compatibility with Internet Explorer 4 Section 17.4. DOM Compatibility with Netscape 4 Section 17.5. Convenience Methods: The Traversal and Range APIs Chapter 18. Cascading Style Sheets and Dynamic HTML Section 18.1. Styles and Style Sheets with CSS Section 18.2. Element Positioning with CSS Section 18.3. Scripting Styles Section 18.4. DHTML in Fourth-Generation Browsers Section 18.5. Other DOM APIs for Styles and Style Sheets Chapter 19. Events and Event Handling Section 19.1. Basic Event Handling Section 19.2. Advanced Event Handling with DOM Level 2 Section 19.3. The Internet Explorer Event Model Section 19.4. The Netscape 4 Event Model Chapter 20. Compatibility Techniques Section 20.1. Platform and Browser Compatibility Section 20.2. Language Version Compatibility Section 20.3. Compatibility with Non-JavaScript Browsers Chapter 21. JavaScript Security Section 21.1. JavaScript and Security Section 21.2. Restricted Features Section 21.3. The Same-Origin Policy Section 21.4. Security Zones and Signed Scripts Chapter 22. Using Java with JavaScript Section 22.1. Scripting Java Applets Section 22.2. Using JavaScript from Java Section 22.3. Using Java Classes Directly Section 22.4. LiveConnect Data Types Section 22.5. LiveConnect Data Conversion Section 22.6. JavaScript Conversion of JavaObjects Section 22.7. Java-to-JavaScript Data Conversion Part III: Core JavaScript Reference Chapter 23. Core JavaScript Reference Sample Entry arguments[ ] Arguments Arguments.callee Arguments.length Array Array.concat( ) Array.join( ) Array.length Array.pop( ) Array.push( ) Array.reverse( ) Array.shift( ) Array.slice( ) Array.sort( ) Array.splice( ) Array.toLocaleString( ) Array.toString( ) Array.unshift( ) Boolean Boolean.toString( ) Boolean.valueOf( ) Date Date.getDate( ) Date.getDay( ) Date.getFullYear( ) Date.getHours( ) Date.getMilliseconds( ) Date.getMinutes( ) Date.getMonth( ) Date.getSeconds( ) Date.getTime( ) Date.getTimezoneOffset( ) Date.getUTCDate( ) Date.getUTCDay( ) Date.getUTCFullYear( ) Date.getUTCHours( ) Date.getUTCMilliseconds( ) Date.getUTCMinutes( ) Date.getUTCMonth( ) Date.getUTCSeconds( ) Date.getYear( ) Date.parse( ) Date.setDate( ) Date.setFullYear( ) Date.setHours( ) Date.setMilliseconds( ) Date.setMinutes( ) Date.setMonth( ) Date.setSeconds( ) Date.setTime( ) Date.setUTCDate( ) Date.setUTCFullYear( ) Date.setUTCHours( ) Date.setUTCMilliseconds( ) Date.setUTCMinutes( ) Date.setUTCMonth( ) Date.setUTCSeconds( ) Date.setYear( ) Date.toDateString( ) Date.toGMTString( ) Date.toLocaleDateString( ) Date.toLocaleString( ) Date.toLocaleTimeString( ) Date.toString( ) Date.toTimeString( ) Date.toUTCString( ) Date.UTC( ) Date.valueOf( ) decodeURI( ) decodeURIComponent( ) encodeURI( ) encodeURIComponent( ) Error Error.message Error.name Error.toString( ) escape( ) eval( ) EvalError Function Function.apply( ) Function.arguments[] Function.call( ) Function.caller Function.length Function.prototype Function.toString( ) Global Infinity isFinite( ) isNaN( ) Math Math.abs( ) Math.acos( ) Math.asin( ) Math.atan( ) Math.atan2( ) Math.ceil( ) Math.cos( ) Math.E Math.exp( ) Math.floor( ) Math.LN10 Math.LN2 Math.log( ) Math.LOG10E Math.LOG2E Math.max( ) Math.min( ) Math.PI Math.pow( ) Math.random( ) Math.round( ) Math.sin( ) Math.sqrt( ) Math.SQRT1_2 Math.SQRT2 Math.tan( ) NaN Number Number.MAX_VALUE Number.MIN_VALUE Number.NaN Number.NEGATIVE_INFINITY Number.POSITIVE_INFINITY Number.toExponential( ) Number.toFixed( ) Number.toLocaleString( ) Number.toPrecision( ) Number.toString( ) Number.valueOf( ) Object Object.constructor Object.hasOwnProperty( ) Object.isPrototypeOf( ) Object.propertyIsEnumerable( ) Object.toLocaleString( ) Object.toString( ) Object.valueOf( ) parseFloat( ) parseInt( ) RangeError ReferenceError RegExp RegExp.exec( ) RegExp.global RegExp.ignoreCase RegExp.lastIndex RegExp.source RegExp.test( ) RegExp.toString( ) String String.charAt( ) String.charCodeAt( ) String.concat( ) String.fromCharCode( ) String.indexOf( ) String.lastIndexOf( ) String.length String.localeCompare( ) String.match( ) String.replace( ) String.search( ) String.slice( ) String.split( ) String.substr( ) String.substring( ) String.toLocaleLowerCase( ) String.toLocaleUpperCase( ) String.toLowerCase( ) String.toString( ) String.toUpperCase( ) String.valueOf( ) SyntaxError TypeError undefined unescape( ) URIError Part IV: Client-Side JavaScript Reference Chapter 24. Client-Side JavaScript Reference Sample Entry Anchor Applet Area Button Button.onclick Checkbox Checkbox.onclick Document Document.all[] Document.captureEvents( ) Document.clear( ) Document.close( ) Document.cookie Document.domain Document.elementFromPoint( ) Document.getSelection( ) Document.handleEvent( ) Document.lastModified Document.links[] Document.open( ) Document.releaseEvents( ) Document.routeEvent( ) Document.URL Document.write( ) Document.writeln( ) Element Event FileUpload FileUpload.onchange Form Form.elements[] Form.onreset Form.onsubmit Form.reset( ) Form.submit( ) Form.target Frame getClass( ) Hidden History History.back( ) History.forward( ) History.go( ) HTMLElement HTMLElement.contains( ) HTMLElement.getAttribute( ) HTMLElement.handleEvent( ) HTMLElement.insertAdjacentHTML( ) HTMLElement.insertAdjacentText( ) HTMLElement.onclick HTMLElement.ondblclick HTMLElement.onhelp HTMLElement.onkeydown HTMLElement.onkeypress HTMLElement.onkeyup HTMLElement.onmousedown HTMLElement.onmousemove HTMLElement.onmouseout HTMLElement.onmouseover HTMLElement.onmouseup HTMLElement.removeAttribute( ) HTMLElement.scrollIntoView( ) HTMLElement.setAttribute( ) Image Image.onabort Image.onerror Image.onload Input Input.blur( ) Input.click( ) Input.focus( ) Input.name Input.onblur Input.onchange Input.onclick Input.onfocus Input.select( ) Input.type Input.value JavaArray JavaClass JavaObject JavaPackage JSObject JSObject.call( ) JSObject.eval( ) JSObject.getMember( ) JSObject.getSlot( ) JSObject.getWindow( ) JSObject.removeMember( ) JSObject.setMember( ) JSObject.setSlot( ) JSObject.toString( ) Layer Layer.captureEvents( ) Layer.handleEvent( ) Layer.load( ) Layer.moveAbove( ) Layer.moveBelow( ) Layer.moveBy( ) Layer.moveTo( ) Layer.moveToAbsolute( ) Layer.offset( ) Layer.releaseEvents( ) Layer.resizeBy( ) Layer.resizeTo( ) Layer.routeEvent( ) Link Link.onclick Link.onmouseout Link.onmouseover Link.target Location Location.reload( ) Location.replace( ) MimeType Navigator Navigator.javaEnabled( ) Navigator.plugins.refresh( ) Option Password Plugin Radio Radio.onclick Reset Reset.onclick Screen Select Select.onchange Select.options[] Style Submit Submit.onclick Text Text.onchange Textarea Textarea.onchange URL Window Window.alert( ) Window.back( ) Window.blur( ) Window.captureEvents( ) Window.clearInterval( ) Window.clearTimeout( ) Window.close( ) Window.confirm( ) Window.defaultStatus Window.focus( ) Window.forward( ) Window.handleEvent( ) Window.home( ) Window.moveBy( ) Window.moveTo( ) Window.name Window.navigate( ) Window.onblur Window.onerror Window.onfocus Window.onload Window.onmove Window.onresize Window.onunload Window.open( ) Window.print( ) Window.prompt( ) Window.releaseEvents( ) Window.resizeBy( ) Window.resizeTo( ) Window.routeEvent( ) Window.scroll( ) Window.scrollBy( ) Window.scrollTo( ) Window.setInterval( ) Window.setTimeout( ) Window.status Window.stop( ) Part V: W3C DOM Reference Chapter 25. W3C DOM Reference Sample Entry AbstractView AbstractView.getComputedStyle( ) Attr CDATASection CharacterData CharacterData.appendData( ) CharacterData.deleteData( ) CharacterData.insertData( ) CharacterData.replaceData( ) CharacterData.substringData( ) Comment Counter CSS2Properties CSSCharsetRule CSSFontFaceRule CSSImportRule CSSMediaRule CSSMediaRule.deleteRule( ) CSSMediaRule.insertRule( ) CSSPageRule CSSPrimitiveValue CSSPrimitiveValue.getCounterValue( ) CSSPrimitiveValue.getFloatValue( ) CSSPrimitiveValue.getRectValue( ) CSSPrimitiveValue.getRGBColorValue( ) CSSPrimitiveValue.getStringValue( ) CSSPrimitiveValue.setFloatValue( ) CSSPrimitiveValue.setStringValue( ) CSSRule CSSRuleList CSSRuleList.item( ) CSSStyleDeclaration CSSStyleDeclaration.getPropertyCSSValue( ) CSSStyleDeclaration.getPropertyPriority( ) CSSStyleDeclaration.getPropertyValue( ) CSSStyleDeclaration.item( ) CSSStyleDeclaration.removeProperty( ) CSSStyleDeclaration.setProperty( ) CSSStyleRule CSSStyleSheet CSSStyleSheet.deleteRule( ) CSSStyleSheet.insertRule( ) CSSUnknownRule CSSValue CSSValueList CSSValueList.item( ) Document Document.createAttribute( ) Document.createAttributeNS( ) Document.createCDATASection( ) Document.createComment( ) Document.createDocumentFragment( ) Document.createElement( ) Document.createElementNS( ) Document.createEntityReference( ) Document.createEvent( ) Document.createNodeIterator( ) Document.createProcessingInstruction( ) Document.createRange( ) Document.createTextNode( ) Document.createTreeWalker( ) Document.getElementById( ) Document.getElementsByTagName( ) Document.getElementsByTagNameNS( ) Document.getOverrideStyle( ) Document.importNode( ) DocumentCSS DocumentEvent DocumentFragment DocumentRange DocumentStyle DocumentTraversal DocumentType DocumentView DOMException DOMImplementation DOMImplementation.createCSSStyleSheet( ) DOMImplementation.createDocument( ) DOMImplementation.createDocumentType( ) DOMImplementation.createHTMLDocument( ) DOMImplementation.hasFeature( ) DOMImplementationCSS Element Element.getAttribute( ) Element.getAttributeNode( ) Element.getAttributeNodeNS( ) Element.getAttributeNS( ) Element.getElementsByTagName( ) Element.getElementsByTagNameNS( ) Element.hasAttribute( ) Element.hasAttributeNS( ) Element.removeAttribute( ) Element.removeAttributeNode( ) Element.removeAttributeNS( ) Element.setAttribute( ) Element.setAttributeNode( ) Element.setAttributeNodeNS( ) Element.setAttributeNS( ) ElementCSSInlineStyle Entity EntityReference Event Event.initEvent( ) Event.preventDefault( ) Event.stopPropagation( ) EventException EventListener EventTarget EventTarget.addEventListener( ) EventTarget.dispatchEvent( ) EventTarget.removeEventListener( ) HTMLAnchorElement HTMLAnchorElement.blur( ) HTMLAnchorElement.focus( ) HTMLBodyElement HTMLCollection HTMLCollection.item( ) HTMLCollection.namedItem( ) HTMLDocument HTMLDocument.close( ) HTMLDocument.getElementById( ) HTMLDocument.getElementsByName( ) HTMLDocument.open( ) HTMLDocument.write( ) HTMLDocument.writeln( ) HTMLDOMImplementation HTMLElement HTMLFormElement HTMLFormElement.reset( ) HTMLFormElement.submit( ) HTMLInputElement HTMLInputElement.blur( ) HTMLInputElement.click( ) HTMLInputElement.focus( ) HTMLInputElement.select( ) HTMLOptionElement HTMLSelectElement HTMLSelectElement.add( ) HTMLSelectElement.blur( ) HTMLSelectElement.focus( ) HTMLSelectElement.remove( ) HTMLTableCaptionElement HTMLTableCellElement HTMLTableColElement HTMLTableElement HTMLTableElement.createCaption( ) HTMLTableElement.createTFoot( ) HTMLTableElement.createTHead( ) HTMLTableElement.deleteCaption( ) HTMLTableElement.deleteRow( ) HTMLTableElement.deleteTFoot( ) HTMLTableElement.deleteTHead( ) HTMLTableElement.insertRow( ) HTMLTableRowElement HTMLTableRowElement.deleteCell( ) HTMLTableRowElement.insertCell( ) HTMLTableSectionElement HTMLTableSectionElement.deleteRow( ) HTMLTableSectionElement.insertRow( ) HTMLTextAreaElement HTMLTextAreaElement.blur( ) HTMLTextAreaElement.focus( ) HTMLTextAreaElement.select( ) LinkStyle MediaList MediaList.appendMedium( ) MediaList.deleteMedium( ) MediaList.item( ) MouseEvent MouseEvent.initMouseEvent( ) MutationEvent MutationEvent.initMutationEvent( ) NamedNodeMap NamedNodeMap.getNamedItem( ) NamedNodeMap.getNamedItemNS( ) NamedNodeMap.item( ) NamedNodeMap.removeNamedItem( ) NamedNodeMap.removeNamedItemNS( ) NamedNodeMap.setNamedItem( ) NamedNodeMap.setNamedItemNS( ) Node Node.appendChild( ) Node.cloneNode( ) Node.hasAttributes( ) Node.hasChildNodes( ) Node.insertBefore( ) Node.isSupported( ) Node.normalize( ) Node.removeChild( ) Node.replaceChild( ) NodeFilter NodeIterator NodeIterator.detach( ) NodeIterator.nextNode( ) NodeIterator.previousNode( ) NodeList NodeList.item( ) Notation ProcessingInstruction Range Range.cloneContents( ) Range.cloneRange( ) Range.collapse( ) Range.compareBoundaryPoints( ) Range.deleteContents( ) Range.detach( ) Range.extractContents( ) Range.insertNode( ) Range.selectNode( ) Range.selectNodeContents( ) Range.setEnd( ) Range.setEndAfter( ) Range.setEndBefore( ) Range.setStart( ) Range.setStartAfter( ) Range.setStartBefore( ) Range.surroundContents( ) Range.toString( ) RangeException Rect RGBColor StyleSheet StyleSheetList StyleSheetList.item( ) Text Text.splitText( ) TreeWalker TreeWalker.firstChild( ) TreeWalker.lastChild( ) TreeWalker.nextNode( ) TreeWalker.nextSibling( ) TreeWalker.parentNode( ) TreeWalker.previousNode( ) TreeWalker.previousSibling( ) UIEvent UIEvent.initUIEvent( ) ViewCSS Part VI: Class, Property, Method, and Event Handler Index Chapter 26. Class, Property, Method, and Event Handler Index Section 26.1. A Section 26.2. B Section 26.3. C Section 26.4. D Section 26.5. E Section 26.6. F Section 26.7. G Section 26.8. H Section 26.9. I Section 26.10. J Section 26.11. K Section 26.12. L Section 26.13. M Section 26.14. N Section 26.15. O Section 26.16. P Section 26.17. Q Section 26.18. R Section 26.19. S Section 26.20. T Section 26.21. U Section 26.22. V Section 26.23. W Section 26.24. X Section 26.25. Y Section 26.26. Z
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值