NoW*_*een 9 javascript dom overriding
appendChild = function(message) {
console.log("intercepted!");
}
Run Code Online (Sandbox Code Playgroud)
使用上面的代码似乎不起作用.
有谁知道?
Den*_*ret 15
您可能想要替换的是,Element.prototype.appendChild
但这可能是一个坏主意.
此示例intercepted
在inserted元素中添加文本:
var f = Element.prototype.appendChild;
Element.prototype.appendChild = function(){f.apply(this, arguments);arguments[0].innerHTML="!Intercepted!"; };
document.body.appendChild(document.createElement("div"));
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3559 次 |
最近记录: |