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
I discovered one issue which is that when cloning a node which contains one or more <template> tags in the tree, the template elements don't clone properly. The data is still there but there's more than one DocumentFragment and the element gets serialized to <template></template>. I came up with a workaround to create a new template element, pull the right document fragment out, and swap the bad element for the new one:
new_node=item_node.clone# any template elements will be "empty" now# workaround:new_node.css("template").eachdo |bad_tmpl|
frag=bad_tmpl.children.lastnew_tmpl=item_node.document.create_element("template")bad_tmpl.attributes.eachdo |k,v|
new_tmpl[k]=vendnew_tmpl.children[0].children=fragbad_tmpl.swap(new_tmpl)end
Environment
OS: macOS Ventura 13.2.1
Ruby version: 3.1.0
Nokolexbor version: 0.3.7
The text was updated successfully, but these errors were encountered:
Thanks for the great library!
I discovered one issue which is that when cloning a node which contains one or more
<template>
tags in the tree, the template elements don't clone properly. The data is still there but there's more than one DocumentFragment and the element gets serialized to<template></template>
. I came up with a workaround to create a new template element, pull the right document fragment out, and swap the bad element for the new one:example
item_node
HTML:trying to clone that node:
Environment
The text was updated successfully, but these errors were encountered: