Skip to content

In Vue components, an attribute value like ?a=1&region=eu loses its text: legacy references are decoded with the text rule #311

Closed

Description

@JuroOravec

What happens

In a component that uses Vue, an attribute value with a legacy character reference followed by = or a letter or digit is decoded as if it were text, so the URL or value changes. For example:

<a href="/search?q=x&region=eu">Search</a>

renders with href="/search?q=x®ion=eu": &reg became ®. The browser, and Vue's own compiler (@vue/compiler-dom 3.5.44), keep such a reference as typed inside an attribute value (&region=eu, 'a&copy=b') and still decode one at the end of a value.

Cause

Citry's patched Vize compiler (third_party/rust/vize_s1_to_s2/src/emit) decodes attribute values and directive expressions with the HTML text rule instead of the attribute-value rule. _vue/direct_capture.py also decodes some source attribute reads with the text rule.

Fix direction

Use the attribute-value rule (as @vue/compiler-dom does, and as citry.util.html.decode_attribute_entities already does) for attribute values and directive expressions.

Found while reviewing #310.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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