removeAttribute doesn't respect boolean attribute's default value

Issue #12087679 • Assigned to Kris K.

Details

Author
Adeel M.
Created
May 21, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
15.15063
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

https://jsfiddle.net/kmk0y0yr/

Given the markup:

<select>
  <option>Zero
  <option id="one" selected>One
</select>

we cannot remove the attribute selected just using one-liner:

document.getElementById('one').removeAttribute('selected');

we have to set some value to the boolean attribute to make it work:

var one = document.getElementById('one');
one.setAttribute('selected', false); // hack for MS Edge
one.removeAttribute('selected');

It works without this hack in Chrome and Firefox.

Attachments

0 attachments

    Comments and activity

    • Changed Steps to Reproduce

      Changed Steps to Reproduce

      Changed Steps to Reproduce

      Changed Steps to Reproduce

    • Microsoft Edge Team

      Changed Assigned To to “James M.”

      Changed Assigned To to “Travis L.”

      Changed Title from “removeAttribute doesn't respect boolean attribute's default value” to “removeAttribute doesn't respect boolean attribute's default value”

      Changed Assigned To from “Travis L.” to “Arron E.”

      Changed Assigned To from “Arron E.” to “Kris K.”

    You need to sign in to your Microsoft account to add a comment.

    Sign in