You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MDN documentation for the <template> element specifies that its content is processed, but never rendered. This means that if you try to query the content you should end up with nothing. This behaviour was seemingly broken in rc4.
Simple code example:
const {load} = require("cheerio");
const $ = load(`<template id="temp">
<div id="insert">
<p>In a template</p>
</div>
</template>
<div id="container"></div>`);
console.log("Inside template:", $("#insert").length); // 1, should be 0
const templateElement = $("#temp");
const templateContentClone = templateElement.contents();
$("#container").append(templateContentClone);
console.log("Now appended:", $("#insert").length); // outputs 1 as expected (but outputs 0 in rc3)
Whether this is a problem related to parse5 I don't know yet, the original implementation says that template contents cannot be queried directly but testing in a browser, you can query it as soon as it is added to the body and thus rendered.
The text was updated successfully, but these errors were encountered:
The MDN documentation for the
<template>
element specifies that its content is processed, but never rendered. This means that if you try to query the content you should end up with nothing. This behaviour was seemingly broken in rc4.Simple code example:
Whether this is a problem related to
parse5
I don't know yet, the original implementation says that template contents cannot be queried directly but testing in a browser, you can query it as soon as it is added to thebody
and thus rendered.The text was updated successfully, but these errors were encountered: