Skip to content

Commit

Permalink
add review comment regarding MutationObserver to AccessiblePeer, see #…
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Feb 18, 2019
1 parent ad9f50c commit c9c172a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion js/accessibility/AccessiblePeer.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ define( function( require ) {
// NOTE: ResizeObserver is a superior alternative to MutationObserver for this purpose because
// it will only monitor changes we care about and prevent infinite callback loops if size is changed in
// the callback function (we get around this now by not observing attribute changes). But it is not yet widely
// supported, see https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver
// supported, see https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver.
//
// TODO: Should we be watching "model" changes from Accessibility.js instead of using MutationObserver?
// See https://github.com/phetsims/scenery/issues/852. This would be less fragile, and also less
// memory intensive because we don't need an instance of MutationObserver on every AccessibleInstance.
this.mutationObserver = this.mutationObserver || new MutationObserver( this.invalidateCSSPositioning.bind( this ) );

// @private {function} - must be removed on disposal
Expand Down

0 comments on commit c9c172a

Please sign in to comment.