2015-05-28 37 views
6

我寫一個餅圖在我的應用
但它總是與bubble_compiled.js
錯誤,當我在餡餅點擊,它不具有動畫, 它顯示Uncaught TypeError: a.target.className.indexOf is not a function 爲什麼?highcharts始終控制檯錯誤ablout bubble_compiled.js?

+2

請給我們看一個代碼示例嗎?你做了什麼? – Igor

+0

或者現場演示問題會很好。另外,你從哪裏得到bubble_compiles.js文件? –

回答

23

我點擊我的D3圖表時遇到過同樣的錯誤。

bubble_compiled.jsGoogle Translate Chrome Extension的一部分。禁用/刪除這個擴展會使錯誤消失,但這個錯誤不應該影響你的網站。

發生此錯誤是因爲擴展程序有一個mousedown偵聽器,它試圖檢查目標元素是否具有類「jfk-bubble-closebtn」。

相關代碼的擴展名(full source here):

P(window, "mousedown", function(a) { 
    var b = Ub(document, "gtx-trans"); 
    b && (ec(b, a.target) ? a.preventDefault() : (Tc(b), 
    dc(b))); 
    -1 != a.target.className.indexOf("jfk-bubble-closebtn") && a.preventDefault() 
} 

由於您使用Highcharts,你可能會嘗試點擊SVG元素上。 SVG類名稱的類型爲SVGAnimatedString,與String不同,它沒有indexOf方法。所以當擴展試圖調用它時,它會失敗,因爲它不存在。

另請參閱:Chrome and a TypeError due to SVGAnimatedString