bitovi/canjs — pull request #641 by justinbmeyer (2014-01-04 06:05:26+00:00)
Title: Observe attributes for #637

Pertaining to #637, this pull request lets you listen to when HTML attributes change. For example:

```js
var div = $("

")

div.bind("attributes", function(ev){
ev.attributeName //-> "foo"
ev.oldValue //-> null
ev.type //-> "attributes"
})

div.attr("foo","bar")
```

It integrates directly with jQuery and Zepto's `attr`,and `removeAttr`, Mootool's `set`, and Dojo's `dojo.setAttr` and `dojo.removeAttr`.

It's tested against live-binding so that changes to `attrValue` in the following will fire `attributes` events:

```

```

Attributes with jQuery works via MutationObserver in browsers that support it. No other library uses MutationObservers. All browsers should work, but I have not tested IE.