Open
Description
What's the issue?
When trying to add amp-date-countdown dynamically using amp-script, a "Sanitized node" error is printed to the console, and it isn't added to the DOM.
How do we reproduce the issue?
JSBin: https://jsbin.com/tenozoxoko/edit?html,output
<!DOCTYPE html>
<html ⚡>
<head>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-script" src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script>
<script async custom-element="amp-date-countdown" src="https://cdn.ampproject.org/v0/amp-date-countdown-0.1.js"></script>
</head>
<body>
<amp-script layout="container" script="hello-script" development>
<button>Add timer</button>
<div id="timer"></div>
</amp-script>
<script id="hello-script" type="text/plain" target="amp-script">
const btn = document.querySelector('button');
btn.addEventListener('click', () => {
const timer = document.getElementById('timer');
timer.innerHTML = `
<amp-date-countdown layout="fixed" height="100" width="300" timestamp-seconds="2147483648">
<template type="amp-mustache">
{{d}}:{{h}}:{{m}}:{{s}}
</template>
</amp-date-countdown>
`
})
</script>
</body>
</html>
Create a page that uses amp-script, and within the script, dynamically add an amp-date-countdown to the DOM.
What browsers are affected?
All browsers appear to be affected.
Which AMP version is affected?
Version 1910251950120.
Activity