0
僅適用於Firefox瀏覽器的某種問題。我有在頁面上輸入元素,基本上做這一個jQuery的處理程序:錯誤:權限被拒絕訪問屬性「toString」,僅適用於Firefox Mac
function() {
$(this).parent().find("label").css({
"background-color": "#000"
})
}
這是直接從開發人員工具欄中的處理程序。處理程序正在執行,但控制檯顯示拒絕訪問屬性「toString」的權限。我在Firefox上看到過很多關於這個問題的文章(我沒有在Mac或Safari瀏覽器中看到這個錯誤),但是這些並不能真正爲我的問題提供解決方案。我試過禁用一些插件和插件,但仍然有問題。
下面是一些更詳細:
HTML:
<div class="printreportwrapper">
<section data-section-name="Other findings">
<header class="level2">Other findings</header>
<p>
<label for="T3_48" style="background-color: transparent;">Liver:</label>
<input id="T3_48" name="T3_48" value="Normal." type="text">
</p>
. . .
. . .
</section>
</div>
JS:
$(".printreportwrapper input").on("mouseleave", function() {$(this).parent().find("label").css({"background-color" : "transparent"})});
$(".printreportwrapper input").on("mouseenter",function() {$(this).parent().find("label").css({"background-color" : "#555"})});
它實際上可能是完全無關,所有這一切,因爲如果我分離從處理程序那裏的輸入字段我仍然看到FF開發人員工具中的錯誤,並且當我點擊右側的錯誤鏈接時,它會將我帶到我的樣式表之一:
<style type="text/css">
.vieweroverlay {
height: 100%;
width: 0;
position: fixed;
z-index: 10;
left: 0px;
top: 0px;
. . .
. . .
}
</style>
這是FF dev的錯誤:
Error: Permission denied to access property "toString"[Learn More] My_telerad:90:5
handleMouseoverEvent https://sscotti.net/pro/My_telerad:90:5
和點上面提到的CSS。它似乎與處理程序沒有關係。
你能提供更多的代碼(相應的HTML和整個JS)。如果處理程序是從一個事件中調用的,比如'click'或'focus'或其他東西,那麼'$(this)'可能是事件而不是元素本身,並且找到父項會導致錯誤。 – michelgotta
我不清楚你面臨的是什麼問題。如果你知道FF所反對的代碼,也許你可以澄清問題陳述。如果您不確定導致錯誤的原因,那麼追蹤錯誤來源可能是有用的第一步。使用刪除過程並刪除代碼(JavaScript,CSS,HTML),直到錯誤消失。 –
我會繼續尋找。它似乎只是一個FF問題,所以也許它與我爲FF安裝的一些附加組件或擴展相關。 – sscotti