Files
odoo_source/addons/website/static/lib/MutationObservers/test/mixed.js
T
Xavier Morel a7e58993cd [ADD] oe_dirty handling via mutation observers
shim necessary for browsers supporting old mutation events but not new mutation observers

bzr revid: xmo@openerp.com-20130828084945-yfqrs0v9v8iecwjm
2013-08-28 10:49:45 +02:00

36 lines
951 B
JavaScript

/*
* Copyright 2012 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
*/
suite('JsMutationObserver mixed types', function() {
test('attr and characterData', function() {
var div = document.createElement('div');
var text = div.appendChild(document.createTextNode('text'));
var observer = new JsMutationObserver(function() {});
observer.observe(div, {
attributes: true,
characterData: true,
subtree: true
});
div.setAttribute('a', 'A');
div.firstChild.data = 'changed';
var records = observer.takeRecords();
assert.strictEqual(records.length, 2);
expectRecord(records[0], {
type: 'attributes',
target: div,
attributeName: 'a',
attributeNamespace: null
});
expectRecord(records[1], {
type: 'characterData',
target: div.firstChild
});
});
});