I tried below but it not return the attributes
rewriter.on(selector, {
element(element) {
for (var key in element.attributes) {
console.log(key) // it print only 'next'
}
}
}
I tried below but it not return the attributes
rewriter.on(selector, {
element(element) {
for (var key in element.attributes) {
console.log(key) // it print only 'next'
}
}
}
attributes property is not an array or a key-value object, it is an iterable object.
Use Array.from to convert an iterable object to a key-value array [[“key1”, “value1”], [“key2”, “value2”]].
rewriter.on(selector, {
element(element) {
Array.from(element.attributes).forEach(a => console.log(a));
}
}
Thank you, it work.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.