From d28581c425a99950ea682100ee76857ccd24e13b Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Tue, 4 Oct 2022 07:19:17 +0200 Subject: [PATCH] Set empty string for reflection of IDREF attributes To avoid issues with wrong IDs in IDREF attributes we set the content attribute's value to the empty string in the setter steps for Element and FrozenArray. Fixes #8306 --- source | 55 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 53 deletions(-) diff --git a/source b/source index 6807f770ce9..8acca522cf7 100644 --- a/source +++ b/source @@ -7789,23 +7789,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute -
  • Let id be the empty string.

  • - -
  • -

    If the given value:

    - -
      -
    • has the same root as this, and
    • -
    • has an id attribute, and
    • -
    • is the first element in this's node tree whose ID is the value of that id - attribute,
    • -
    - -

    then set id to the given value's ID.

    -
  • - -
  • Set the content attribute's value for this to id.

  • +
  • Set the content attribute's value for this to the empty string.

  • Set this's explicitly set attr-element to a weak reference to the given value.

  • @@ -7952,51 +7936,16 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute -
  • Let value be an empty string.

  • -
  • For each element in the given value:

      -
    1. -

      If value is empty and elements is non-empty, then:

      - -
        -
      1. Append a weak reference to element - to elements.

      2. - -
      3. Continue.

      4. -
      -
    2. -
    3. Append a weak reference to element to elements.

    4. - -
    5. -

      If element:

      - -
        -
      • does not have the same root as this, or
      • -
      • has no id attribute, or
      • -
      • is not the first element in this's node tree whose ID is the value of that id - attribute,
      • -
      - -

      then set value to the empty string, and continue.

      -
    6. - -
    7. Let id be element's ID.

    8. - -
    9. If value is not the empty string, then append U+0020 SPACE to - value.

    10. - -
    11. Append id to value.

  • -
  • Set the content attribute's value for this to value.

  • +
  • Set the content attribute's value for this to the empty string.

  • Set this's explicitly set attr-elements to elements.