Javascript DOM“这个”对象不正确

编程入门 行业动态 更新时间:2024-10-27 00:34:07
本文介绍了Javascript DOM“这个”对象不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 有没有人可以解释followig错误信息? 我试图获得关于mutiple div的简单信息,而其中一个引发了这个错误。

忽略get或set具有[LenientThis]的属性,因为this对象不正确。 (script.js:3288)

resource:// gre / modules / devtools / server /actors/script.js

我使用的代码是:

var elem = document.getElementById(id); ret ['left'] = Math.round(elem.offsetLeft); //elem.offsetLeft返回null

我以前没有看到这样的错误,找不到关于这个问题的任何信息。如果有人可以告诉我,我做错什么会很棒。

解决方案

@ felix-king是正确的,这个是一个firefox devtools错误。通常当您检查对象并且打开比正在检查的实例的类型低的基本原型树节点时,会发生这种情况。所以这解释了@ jfriend00在评论中提到的这个错误问题,即使你在代码中没有引用this,检查器也可以。

Is there anybody who can explain the followig error message? I'm trying to get simple informations about mutiple divs while one of them throws this error.

Ignoring get or set of property that has [LenientThis] because the "this" object is incorrect. (script.js:3288)

resource://gre/modules/devtools/server/actors/script.js

The Code i'm using is:

var elem = document.getElementById(id); ret['left'] = Math.round(elem.offsetLeft); //elem.offsetLeft returns null

I haven't seen such an error before and can't find any information about this problem. It would be great if somebody could tell me, what i'm doing wrong.

解决方案

@felix-king is correct, this is a firefox devtools errors. It usually happens when you inspect an object and you open a base prototype tree node lower than the type of the instance you are inspecting. So this explains the "this" error problem that @jfriend00 refers to in the comment, even though you don't reference "this" in your code, the Inspector does.

更多推荐

Javascript DOM“这个”对象不正确

本文发布于:2023-11-09 15:16:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572706.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不正确   对象   Javascript   DOM

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!