问题描述
有没有一般原因不处理Document和Element的原型?
我喜欢创建自己的小框架,因为我当前的项目不需要
我不需要支持不支持Element / Document-constructor的浏览器,也不会执行不在下面的脚本因此,你会建议扩展原型,还是应该按照通常的方式从Element / Document创建自己的对象?
您计划扩展默认DOM元素吗?如果是,请不要。 Juriy Zaytsev(又名Kangax)清楚地描述了为什么不在。
Are there general reasons not to deal with Document's and Element's prototype?
I like to create my own little framework, because my current project doesn't need the mass of features of the existing frameworks.
I don't need to support browsers which don't support Element/Document-constructor and also will not execute scripts that are not under my control.
So would you recommend to extend the prototype or should I go the usual way and create own objects from Element/Document?
Do you plan to extend default DOM elements? If so, please don't. Juriy Zaytsev (aka Kangax) clearly describes why not in What’s wrong with extending the DOM.
这篇关于一般原因不处理Document和Element的原型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!