Open basher opened 1 week ago
The inline <script>
tags get moved to a #scripts-root
node, so they do actually "execute" whatever is inside them.
However, I need the scripts to remain where they are originally - i.e. inside #storybook-root
- so that I can mimic the real behaviour of the web app that I'm Storybooking.
Describe the bug
I'm creating a new UI component library for an existing web app in Storybook/HTML.
Component HTML contains inline
<script>
tags, which are getting stripped out of story DOM:These inline scripts need to be detectable via
document.querySelector()
inside global script, which are loaded insidepreview-head.html
.They're returning
null
.Is there a reason why inline scripts get removed from DOM???
Reproduction link
https://github.com/basher/sb-test
Reproduction steps
preview-head.html
cannot find inline script tags inside story DOM.System
Storybook Environment Info:
System: OS: Windows 10 10.0.19045 CPU: (4) x64 Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz Binaries: Node: 20.11.0 - C:\Program Files\nodejs\node.EXE npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD <----- active Browsers: Chrome: 129.0.6668.90 Edge: Chromium (127.0.2651.74) npmPackages: @storybook/html: ^8.2.3 => 8.3.5 @storybook/html-vite: ^8.2.3 => 8.3.5 storybook: ^8.2.3 => 8.3.5
Additional context
No response