How to access a shadow-root( associated mode is "closed"? or using the old shadow DOM standard ?)
Posted: Thu Mar 19, 2020 2:04 am
when the mode of a shadow-root is closed, I cannot use element.shadowroot to visit elements in it.
Is it possible to visit them?
Keen for your help,Thank you!
----------
<input name="UserName" type="text" maxlength="64" id="UserName" #shadow-root (user-agent)<div pseudo="-webkit-input-placeholder" id="placeholder" </div>
---------
x=document.getElementById("UserName");
x.shadowRoot
[null]
even I use this:
procedure TIinformSearchFrm.Chromium1BeforeResourceLoad(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame;
const request: ICefRequest; const callback: ICefRequestCallback;
out Result: TCefReturnValue);
begin
browser.MainFrame.ExecuteJavaScript('Element.prototype._attachShadow = Element.prototype.attachShadow;'
+ 'Element.prototype.attachShadow = function () {'
+ ' return this._attachShadow( { mode: "open" } );'
+ '};',browser.MainFrame.Url, 0 );
----It still not work! May because that it use the old shadow DOM standard?
Is it possible to visit them?
Keen for your help,Thank you!
----------
<input name="UserName" type="text" maxlength="64" id="UserName" #shadow-root (user-agent)<div pseudo="-webkit-input-placeholder" id="placeholder" </div>
---------
x=document.getElementById("UserName");
x.shadowRoot
[null]
even I use this:
procedure TIinformSearchFrm.Chromium1BeforeResourceLoad(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame;
const request: ICefRequest; const callback: ICefRequestCallback;
out Result: TCefReturnValue);
begin
browser.MainFrame.ExecuteJavaScript('Element.prototype._attachShadow = Element.prototype.attachShadow;'
+ 'Element.prototype.attachShadow = function () {'
+ ' return this._attachShadow( { mode: "open" } );'
+ '};',browser.MainFrame.Url, 0 );
----It still not work! May because that it use the old shadow DOM standard?