Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 8 $!MEMBERS | 8 $!MEMBERS |
| 9 /** | 9 /** |
| 10 * Checks to see if the mutation observer API is supported on the current | 10 * Checks to see if the mutation observer API is supported on the current |
| 11 * platform. | 11 * platform. |
| 12 */ | 12 */ |
| 13 static bool get supported { | 13 static bool get supported { |
| 14 $if DARTIUM | 14 $if DARTIUM |
| 15 return true; | 15 return true; |
| 16 $else | 16 $else |
| 17 return JS('bool', | 17 return JS('bool', |
| 18 '!!(window.MutationObserver || window.WebKitMutationObserver)'); | 18 '!!(window.MutationObserver || window.WebKitMutationObserver)'); |
| 19 $endif | 19 $endif |
| 20 } | 20 } |
| 21 | 21 |
| 22 /** | |
| 23 * Observes the target for the specified changes. | |
|
Andrei Mouravski
2013/10/24 17:35:51
Maybe "Observes the target node for DOM changes."
| |
| 24 * | |
|
Andrei Mouravski
2013/10/24 17:35:51
"[childList], ... , and [attributeFilter] configur
| |
| 25 * Some requirements for the optional parameters: | |
| 26 * | |
| 27 * * Either childList, attributes or characterData must be true. | |
|
Andrei Mouravski
2013/10/24 17:35:51
"At least one of [childList]... must be `true`."
| |
| 28 * * If attributeOldValue is true then attributes must also be true. | |
| 29 * * If attributeFilter is specified then attributes must be true. | |
|
Andrei Mouravski
2013/10/24 17:35:51
"...must also be `true`."
| |
| 30 * * If characterDataOldValue is true then characterData must be true. | |
|
Andrei Mouravski
2013/10/24 17:35:51
"...must also be `true`."
| |
| 31 */ | |
| 22 void observe(Node target, | 32 void observe(Node target, |
| 23 {bool childList, | 33 {bool childList, |
| 24 bool attributes, | 34 bool attributes, |
| 25 bool characterData, | 35 bool characterData, |
| 26 bool subtree, | 36 bool subtree, |
| 27 bool attributeOldValue, | 37 bool attributeOldValue, |
| 28 bool characterDataOldValue, | 38 bool characterDataOldValue, |
| 29 List<String> attributeFilter}) { | 39 List<String> attributeFilter}) { |
| 30 | 40 |
| 31 // Parse options into map of known type. | 41 // Parse options into map of known type. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 return JS('MutationObserver', | 94 return JS('MutationObserver', |
| 85 'new(window.MutationObserver||window.WebKitMutationObserver||' | 95 'new(window.MutationObserver||window.WebKitMutationObserver||' |
| 86 'window.MozMutationObserver)(#)', | 96 'window.MozMutationObserver)(#)', |
| 87 convertDartClosureToJS(_wrapBinaryZone(callback), 2)); | 97 convertDartClosureToJS(_wrapBinaryZone(callback), 2)); |
| 88 } | 98 } |
| 89 $else | 99 $else |
| 90 factory MutationObserver(MutationCallback callback) => | 100 factory MutationObserver(MutationCallback callback) => |
| 91 new MutationObserver._(_wrapBinaryZone(callback)); | 101 new MutationObserver._(_wrapBinaryZone(callback)); |
| 92 $endif | 102 $endif |
| 93 } | 103 } |
| OLD | NEW |