Closed runningdemo closed 7 years ago
@liaa You shouldn't really hide a WebView by setting display: none
. You should even unmount completely if you want to destroy it, or use flex: 0
/ width: 0
to conceal it.
I know flex:0
/ width: 0
can make an element disappear visually.
But the did-attach
event behaves really odd when its parent element's property display
changed. So I want to dig more into why this odd behave happens. I can't find more information when I search google about html element did-attach event or electron webview did-attach event. Or should I dig into electron source code to find it, thanks.
@liaa I believe it is just the way guest contents work in Chromium. They automatically detach and attach when they toggle between visible and not visible.
The
did-attach
handler code:I put this
<WebView/>
in adiv
element. Then every time I toggle thediv
CSS property fromdisplay: none
todisplay: block
thedid-attach
event handler get called. That will causes event hander set on<WebView/>
element be attached many times.I attempt to dig more into how does
did-attach
event work, but I can't find information about the event. Can you give me some document link about thedid-attach
event. So I can help on this issue.