gpt4 book ai didi

javascript - 不处理文档和元素原型(prototype)的一般原因

转载 作者:数据小太阳 更新时间:2023-10-29 03:48:18 25 4
gpt4 key购买 nike

是否有不处理 Document 和 Element 原型(prototype)的一般原因?

我喜欢创建自己的小框架,因为我当前的项目不需要现有框架的大量功能。

我不需要支持不支持 Element/Document-constructor 的浏览器,也不会执行不受我控制的脚本。

那么你会建议扩展原型(prototype)还是我应该按照通常的方式从元素/文档创建自己的对象?

最佳答案

您打算扩展默认的 DOM 元素吗?如果是这样,请不要。 Juriy Zaytsev(又名 Kangax)清楚地描述了为什么不在 What’s wrong with extending the DOM 中.

关于javascript - 不处理文档和元素原型(prototype)的一般原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3826599/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com