Closed Bug 1879001 Opened 3 months ago Closed 2 months ago

Attr-associated element still returned when content attribute is reset

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox124 --- fixed

People

(Reporter: Jamie, Assigned: zsun)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Test case:

data:text/html,
<button id="toggle">toggle</button>
<div id="pop" popover>pop</div>
<script>
toggle.popoverTargetElement = pop;
toggle.setAttribute("popovertarget", "invalid");
alert(toggle.popoverTargetElement);
</script>

STR:

  1. Open the test case above.
    • Expected: The alert should say "null"
    • Actual: The alert says "[object HTMLDivElement]"

From the spec:

For element reflected targets only: the following attribute change steps, given element, localName, oldValue, value, and namespace, are used to synchronize between the content attribute and the IDL attribute:

  1. If localName is not attr or namespace is not null, then return.
  2. Set element's explicitly set attr-element to null.

Unless I'm missing something, it seems we're just not doing these attribute change steps.

Removing the attribute also fails to clear the explicitly set attr-element:

data:text/html,
<button id="toggle">toggle</button>
<div id="pop" popover>pop</div>
<script>
toggle.popoverTargetElement = pop;
toggle.removeAttribute("popovertarget");
alert(toggle.popoverTargetElement);
</script>

zsun, can you, please, take a look?

Severity: -- → S3
Flags: needinfo?(zsun)
Assignee: nobody → zsun
Flags: needinfo?(zsun)
Attachment #9379933 - Attachment description: Bug 1879001 - Removing the popovertarget attribute should clear the explicitly set attr-element. r=emilio → Bug 1879001 - Remove the popovertarget attribute or set it to an invalid value should clear the explicitly set attr-element. r=emilio
Pushed by zsun@igalia.com:
https://hg.mozilla.org/integration/autoland/rev/6f0ebcced75f
Remove the popovertarget attribute or set it to an invalid value should clear the explicitly set attr-element. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/44634 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch
Upstream PR merged by moz-wptsync-bot
Regressions: 1881075
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: