现代浏览器不支持“DOMAttrModified”事件?

时间:2015-06-02 06:00:12

标签: javascript jquery html events web

以下是代码(Jsfiddle demo):

import grequests

# Create a map between url and the item
url_to_item = {item.item_low_url: item for item in items}

# Create a request queue, but don't send them
rq = (grequests.head(url) for url in url_to_item.keys())

# Send requests simultaneously, and collect the results,
# and filter those that are valid

# Each item returned in the Response object, which has a request
# property that is the original request to which this is a response;
# we use that to filter out the item objects

results = [url_to_item[i.request.url]
           for i in filter(lambda x: x.status_code == 200,
                           grequests.map(rq)))]

点击<a href="#">Click me!</a> <script> var a = document.body.children[0] a.onclick = function() { alert('in onlick') this.setAttribute('href', 'lala') alert('out onclick') return false } function onpropchange() { alert('onpropchange') } if (a.addEventListener) { // FF, Opera a.addEventListener('DOMAttrModified', onpropchange, false) } if (a.attachEvent) { // IE a.attachEvent('onpropertychange', onpropchange) } </script> 时。 <a href>Click me!</a>未执行..(我使用的是Chrome 43.0)有没有人对此有任何想法?

1 个答案:

答案 0 :(得分:2)

来自docs of mutation events

  

此功能已从网络中删除。虽然有些浏览器可能仍然支持它,但它正在被删除。不要在旧项目或新项目中使用它。使用它的页面或Web应用程序可能随时中断。

尽可能使用mutationObserver