摘要:
function Person(){ } var firend=new Person(); Person.prototype.sayHi=function(){ alert("hi"); } firend.sayHi(); // hi // 没有重写原型!!!! //虽然sayHi()方法是在fir 阅读全文
摘要:
Object.keys() 取得对象中所有可枚举的属性function Person(){}Person.prototype.name="summer";Person.prototype.age=20;Person.prototype.job="enginner";Person.prototype. 阅读全文
摘要:
// in有两种用法,一种是使用在for-in循环中,一种是单独使用。单独使用时,in操作符会在对象可以访问给定属性时返回true function Person(){ } Person.prototype.name="summer"; Person.prototype.age=20; Person 阅读全文
摘要:
使用原型模式创建对象时,使用 hasOwnProperty()可以检测一个属性是存在于实例中,还是原型中。当这一属性存在于实例中时,才返回true function Person(){}Person.prototype.name="summer";Person.prototype.age=20;Pe 阅读全文
摘要:
jQuery基础语法中规定的选择器有三种,分别是类选择器、ID选择器、标签选择器。如:$(“.aa”)、$(“#id”)、$(“div”),但中实际的应用中,DOM机构非常复杂,层级非常多。如何应对这种复杂的场景呢? 给各位小伙伴们总结了复杂结构DOM的查找使用。如下: 1、基础选择器 $(“#my 阅读全文
摘要:
1. DOM 1.1 使用 DocumentFragment 优化多次 append 说明:添加多个 dom 元素时,先将元素 append 到 DocumentFragment 中,最后统一将 DocumentFragment 添加到页面。 该做法可以减少页面渲染 dom 元素的次数。经 IE 和 阅读全文