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

Twiddle text node to trigger ASAP flush #171

Merged
merged 2 commits into from
Dec 18, 2013
Merged

Twiddle text node to trigger ASAP flush #171

merged 2 commits into from
Dec 18, 2013

Conversation

josh
Copy link
Contributor

@josh josh commented Dec 18, 2013

Some buggy MutationObserver implementations or polyfills may not trigger a mutation when an attribute is just set again to the same value.

This text node twiddle approach is based on Polymer's microtask.js.

Fixes #170

Related

/cc @jakearchibald @azakus

Some buggy browsers or polyfills will not trigger a mutation if an
attribute is set to the same value.
@stefanpenner
Copy link
Collaborator

This seems reasonable, but I want to understand if this is a bug in those polyfils or a fundamental limitation. I suspect a limitation.

I don't see any downside to this change, but as this scenario may not be entirely obvious a small inline comment would be appreciated.

@josh
Copy link
Contributor Author

josh commented Dec 18, 2013

This seems reasonable, but I want to understand if this is a bug in those polyfils or a fundamental limitation. I suspect a limitation.

For DOMAttrModified at least, its not fired if the attribute is the same. Though there maybe other ways of detecting via onpropchange. I'm not an expert in the MutationObserver polyfill domain.

We could keep the setAttribute if you'd like and set it to an incremented value. But the text node approach was suggested to me by @azakus.

@stefanpenner
Copy link
Collaborator

@josh seems good, lets give it a try :)

stefanpenner added a commit that referenced this pull request Dec 18, 2013
Twiddle text node to trigger ASAP flush
@stefanpenner stefanpenner merged commit 3f75248 into tildeio:master Dec 18, 2013
@josh josh deleted the asap-twiddle-text-node branch December 18, 2013 19:16
@josh
Copy link
Contributor Author

josh commented Dec 18, 2013

Rad.

Hoping to have github.com running the Promises polyfill by the end of the week.

@stefanpenner
Copy link
Collaborator

nice!

@stefanpenner
Copy link
Collaborator

@josh although not general purpose yet, you might want to checkout our WIP promise tooling: emberjs/ember-inspector#76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ASAP flush is broken with polyfilled MutationObserver
2 participants