I defined a component with polymer like this:
CONTENT
this is my simple function to change capcha in shadow-root
const get_captcha = (CustomElement)=>{
var src = `./app/create_captcha/${chance.natural()}`;
var rootElement = $(CustomElement)[0].shadowRoot;
var captchaElement = $(rootElement).find('#img_captcha');
$(captchaElement).attr('src',src);
};
Use something like this:
jQuery.fn.extend({
shadowRoot: function() {
return $(this.get(0).shadowRoot);
},
});
and call:
$("my-element").shadowRoot());