Skip to content

Scoped styles don't apply to v-html injections #749

@foundryspatial-duncan

Description

@foundryspatial-duncan

Version

11.0.0

Reproduction link

https://github.com/foundryspatial-duncan/vue-loader-issue-demo/blob/master/src/App.vue

Steps to reproduce

  1. In a single-file Vue component (.vue file), add some scoped styles (with the scoped property on the style tag).
  2. Inject some HTML that matches your scoped style's selector with v-html

What is expected?

The styles would affect the injected HTML

What is actually happening?

The styles do not affect the injected HTML


Looks like HTML injected with v-html aren't given the "data-v-[hash]" property (like data-v-08ce5946).
I think there's a proposal somewhere to only add the data-v-[hash] to the component's root element and then prefix all the styles to scope them. That would solve this issue as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions