2016-03-07 87 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)

相关问题