2016-03-07 20 views

回答

0

雖然使用調試器會是一條路,但您也可以將該值設置爲setter,然後使用它來打破值的變化點。例如與

HTML

<div id="a" style="color: red;">My color changes</div> 

腳本

Object.defineProperty(document.getElementById("a").style, "color", { set: function (x) { alert(x); } }); 
document.getElementById("a").style.color = "blue"; 

只是把一個斷點在alert(x),你會直接從突破一個水平遠指向值被改變的地方(只需沿着callstack)

相關問題