2014-10-23 11:17:19 -07:00

28 lines
943 B
HTML

<html>
<link rel="import" href="../resources/chai.html" />
<link rel="import" href="../resources/mocha.html" />
<script>
describe('MutationObserver', function() {
it('should not invoke callbacks when appending a script', function() {
var mutationsDelivered = false;
function callback(mutations) {
mutationsDelivered = true;
}
var observer = new MutationObserver(callback);
var div = document.createElement('div');
observer.observe(div, {attributes: true});
div.setAttribute('foo', 'bar');
assert.notOk(mutationsDelivered);
var scriptDidRun = false;
var script = document.createElement('script');
script.textContent = 'scriptDidRun = true';
assert.notOk(scriptDidRun);
document.documentElement.appendChild(script);
assert.notOk(scriptDidRun);
assert.notOk(mutationsDelivered);
});
});
</script>
</html>