blob: 06f783e6d1e7a23aa33ec95bb66aff646b2b1419 [file] [log] [blame]
Test WebKitMutationObserver.observe on attributes
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Testing basic aspects of attribute observation.
...can attribute changes be observed at all
PASS mutations.length is 2
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "foo"
PASS mutations[0].attributeNamespace is null
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "bar"
PASS mutations[1].attributeNamespace is null
...observer.disconnect() should prevent further delivery of mutations.
PASS mutations is null
...re-observing after disconnect works with the same observer.
PASS mutations.length is 2
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "foo"
PASS mutations[0].attributeNamespace is null
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "bar"
PASS mutations[1].attributeNamespace is null
Testing that observing without specifying "attributes" does not result in hearing about attribute changes.
PASS mutations is null
Testing that re-observing the same node with the same observer has the effect of resetting the options.
PASS calls is 1
PASS mutations.length is 1
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "foo"
PASS mutations is null
Testing that multiple observers can be registered to a given node and both receive mutations.
PASS mutations.length is 1
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "foo"
PASS mutations2.length is 1
PASS mutations2[0].type is "attributes"
PASS mutations2[0].attributeName is "foo"
Testing that "attributeNamespace" value is delivered properly.
PASS mutations.length is 1
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "foo"
PASS mutations[0].attributeNamespace is "http://www.foo.com/bar"
Testing that modifications to node properties which delegate to attribute storage deliver mutations.
PASS mutations.length is 2
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "src"
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "href"
Testing mutation records are enqueued for attributes before DOMSubtreeModified is dispatched.
PASS mutations.length is 2
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "foo"
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "baz"
Testing basic oldValue delivery.
PASS mutations.length is 3
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "foo"
PASS mutations[0].oldValue is null
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "foo"
PASS mutations[1].oldValue is "bar"
PASS mutations[2].type is "attributes"
PASS mutations[2].attributeName is "bar"
PASS mutations[2].oldValue is "boo"
Testing that oldValue is delivered as requested (or not).
PASS mutationsWithOldValue.length is 1
PASS mutationsWithOldValue[0].type is "attributes"
PASS mutationsWithOldValue[0].attributeName is "foo"
PASS mutationsWithOldValue[0].oldValue is "bar"
PASS mutations.length is 1
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "foo"
PASS mutations[0].oldValue is null
An observer with multiple observations will get attributeOldValue if any entries request it.
PASS mutations.length is 1
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "foo"
PASS mutations[0].oldValue is "bar"
Testing setting an attribute via reflected IDL attribute.
PASS mutations.length is 3
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "id"
PASS mutations[0].oldValue is null
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "id"
PASS mutations[1].oldValue is "foo"
PASS mutations[2].type is "attributes"
PASS mutations[2].attributeName is "id"
PASS mutations[2].oldValue is "bar"
Testing that attributeFilter works as expected and observes case with HTML elements.
...only foo and bar should be received.
PASS mutations.length is 2
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "foo"
PASS mutations[0].attributeNamespace is null
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "bar"
PASS mutations[1].attributeNamespace is null
Testing the behavior of attributeFilter when the same observer observes at multiple nodes in a subtree with different filter options.
...only foo, bar & bat should be received.
PASS mutations.length is 3
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "foo"
PASS mutations[0].attributeNamespace is null
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "bar"
PASS mutations[1].attributeNamespace is null
PASS mutations[2].type is "attributes"
PASS mutations[2].attributeName is "bat"
PASS mutations[2].attributeNamespace is null
...bar, bat & baz should all be received.
PASS mutations.length is 3
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "bar"
PASS mutations[0].attributeNamespace is null
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "bat"
PASS mutations[1].attributeNamespace is null
PASS mutations[2].type is "attributes"
PASS mutations[2].attributeName is "baz"
PASS mutations[2].attributeNamespace is null
Testing that setting an attributeFilter filters out namespaced attributes.
...pathLength should not be received.
PASS mutations is null
Testing that attributeFilter respects case with non-HTML elements.
...only ID, id, booM should be received.
PASS mutations.length is 3
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "ID"
PASS mutations[0].attributeNamespace is null
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "id"
PASS mutations[1].attributeNamespace is null
PASS mutations[2].type is "attributes"
PASS mutations[2].attributeName is "booM"
PASS mutations[2].attributeNamespace is null
Testing that modifying an elements style property dispatches Mutation Records.
PASS mutations.length is 3
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "style"
PASS mutations[0].oldValue is null
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "style"
PASS mutations[1].oldValue is null
PASS mutations[2].type is "attributes"
PASS mutations[2].attributeName is "style"
PASS mutations[2].oldValue is null
...mutation record created.
PASS mutations is null
Testing that modifying an elements style property dispatches Mutation Records with correct oldValues.
PASS mutations.length is 3
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "style"
PASS mutations[0].oldValue is "color: yellow; width: 100px;"
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "style"
PASS mutations[1].oldValue is "color: red; width: 100px;"
PASS mutations[2].type is "attributes"
PASS mutations[2].attributeName is "style"
PASS mutations[2].oldValue is "color: red; width: 200px;"
...mutation record created.
PASS mutations is null
Testing that a no-op style property mutation does not create Mutation Records.
PASS mutations is null
Test that mutating an attribute through an attr node delivers mutation records
PASS mutations.length is 1
PASS mutations[0].target is div
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "data-test"
PASS mutations[0].oldValue is "foo"
Test that mutating via setAttributeNode delivers mutation records
PASS mutations.length is 3
PASS mutations[0].target is div
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "data-test"
PASS mutations[0].oldValue is "foo"
PASS mutations[1].target is div
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "data-other"
PASS mutations[1].oldValue is null
PASS mutations[2].target is div
PASS mutations[2].type is "attributes"
PASS mutations[2].attributeName is "id"
PASS mutations[2].oldValue is "myId"
Test that setAttribute on an attribute with an existing Attr delivers mutation records
PASS mutations.length is 1
PASS mutations[0].target is div
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "data-test"
PASS mutations[0].oldValue is "foo"
Test that setNamedItem and removeNamedItem deliver mutation records
PASS mutations.length is 2
PASS mutations[0].target is div
PASS mutations[0].type is "attributes"
PASS mutations[0].attributeName is "data-test"
PASS mutations[0].oldValue is "foo"
PASS mutations[1].target is div
PASS mutations[1].type is "attributes"
PASS mutations[1].attributeName is "data-test"
PASS mutations[1].oldValue is "bar"
PASS successfullyParsed is true
TEST COMPLETE