-
Notifications
You must be signed in to change notification settings - Fork 254
MDL in a shadow dom node #466
Comments
If you're using webpack to bundle, have you tried applying your fix as a shimmed module for |
afraid i'm not sure what you mean--my fix, as in my extension content script? & all I know about shimmed modules is that they're basically passed through |
Fair point, there are multiple kinds of shimming available with webpack. I was thinking of the ProvidePlugin which enables the replacement of a free variable like So your module would be something like this:
And your webpack build would contain something like this:
That make any more sense? |
ahh got it--i hadn't thought to use webpack for the substitution, that's clever. For brevity's sake I ended up just skipping |
Yeah, there's definitely a lot in there. I haven't tried applying it to shadow dom use cases though. If you do find it works, I'd love to know! |
I'm using MDL in a content script for a Chrome Extension. To keep the CSS from bleeding, I'm using a
shadowDOM
node to limitmaterial.css
from leaking into global scope.However, this seems to break
material.js
. Specifically, clicking a button no longer works. Lookingmaterial.js
, it makes frequent use ofdocument
.I tried replacing calls to
document
with calls todocument.querySelector('#shadowroot').shadowRoot
(to limit the scope of any DOM manipulation to the shadow DOM), but there are way too many references for tht to work safely.Has anyone had any success doing this, or any advice? The primary components I need are
Tabs
andButton
.The text was updated successfully, but these errors were encountered: