Skip to content

fix: escape " when inlining <style> rules into style attr#629

Merged
harlan-zw merged 1 commit into
mainfrom
fix/style-quote-escape
Jun 8, 2026
Merged

fix: escape " when inlining <style> rules into style attr#629
harlan-zw merged 1 commit into
mainfrom
fix/style-quote-escape

Conversation

@danielroe

Copy link
Copy Markdown
Contributor

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

A <style scoped> rule whose value contains a ", like a background-image with a url, currently produces invalid HTML when the asset transform inlines it. (the inner " closes the style=" attribute and Vue fails the build with Illegal '/' in tags.)

Repro:

<template>
  <div class="bg-confetti" />
</template>

<style scoped>
.bg-confetti {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='10'%3E%3Crect width='5' height='5'/%3E%3C/svg%3E");
}
</style>

Comment thread src/runtime/server/og-image/core/style-attr.ts Fixed
Comment thread test/unit/vite-asset-transform.test.ts Fixed
@danielroe danielroe force-pushed the fix/style-quote-escape branch from 9727cba to f427312 Compare June 8, 2026 12:24
@pkg-pr-new

pkg-pr-new Bot commented Jun 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nuxt-og-image@629

commit: f427312

@danielroe danielroe requested a review from harlan-zw June 8, 2026 12:32
@harlan-zw harlan-zw merged commit c6cd3c7 into main Jun 8, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants