Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observe attributes for #637 #641

Closed
wants to merge 9 commits into from
Closed

Conversation

justinbmeyer
Copy link
Contributor

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

var div = $("<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:

<div foo="{{attrValue}"/>

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.

@justinbmeyer
Copy link
Contributor Author

merged this into minor myself ...

@justinbmeyer justinbmeyer deleted the observe-attributes branch May 2, 2014 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant