Skip to content

Overriding existing HTML for the sake hydration isn't consistent #13025

@ebraminio

Description

@ebraminio

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNqVUkFOwzAQ/MpqzyUFwSkKSIB6gAMg6A1zMMk2pHVsy3ZKUJS/Y7tNGyqoRA6RMzM7nh2lw2utk3VDmGJm3ZcgsLnSVFwxCZBoQ0LxYgKvBXf8pFYFXTI8ZfgGHbzzfFUa1cgiBUMF9Exm0+jhh/3ZUa0Fd+ELICuqNUTSGxxMMgyK+KSD5Ke9f9GikvESjH4Ac7IuOk+99f6OXHBrvcE2+th7oDrYkv8yPmgA0jFw9ud0Nh31gBN0vl+5qMpkaZX0rXdBzDBXta4EmUftKiUtwxQiEzguhPq8j5gzDU0GPP+gfPULvrRtwBg+GbJk1sRwxzluSnIbevbyQK0/70i/TCO8+gj5TFaJJmTcyG58gz72SBfT3tVaGVfJcm5nrSNph6VC0KDso56h//Vuj6y+j3ueXMQ5JnvsvwHCt+IN

Steps to reproduce

Open the provided Play VueJS link

What is expected?

Neither of the lines to have red background

What is actually happening?

VueJS is able to override existing styles of the HTML before setup but not able to remove existing classes via :class

System Info

Reproduces consistently in different browsers

Any additional comments?

I can guess this can be the current intended behavior if not overlooked and that's understandable to me, my usecase however was to "hydrate" an existing HTML (it's a simple build-less app and doesn't use Vue's SSR) so I have used couple of style="display: none" :style="{ display: undefined }" to display some of the elements only after VueJS' load, but couldn't remove existing classes via class="preload" :class="{ preload: undefined }" or override data data-mode="0" :data-mode="1" and I think making them to act consistent like style overrides is also less surprising for the user. I already have a more of less ugly workaround for it but thought something might be possible from the Vue's side.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions