selected attribute

Tests for crbug.com/307348 and https://www.w3.org/Bugs/Public/show_bug.cgi?id=23574

by int32_t

HTML

<p>1. Parsing selected HTML attribute: <span class="ok">(browsers agree)</span><br/>
<select size=4><option selected>Unselected</option>
    <option selected>Selected</option></select>
</p>
<ul>
    <li>Chrome 30: 'Selected' is selected.</li>
    <li>Firefox 24: 'Selected' is selected.</li>    
    <li>IE 11: 'Selected' is selected.</li>    
    <li>Safari 6: 'Selected' is selected.</li>    
</ul>
    
<p>2. Adding selected HTML attribute to a clean OPTION element: <span class="ok">(browsers agree)</span><br/>
    <select size=4><option id=o2>Selected</option></select>
<script>
function $(id) { return document.getElementById(id); }
$('o2').setAttribute('selected', 'selected');
</script>
</p>
<ul>
    <li>Chrome 30: 'Selected' is selected.</li>
    <li>Firefox 24: 'Selected' is selected.</li>
    <li>IE 11: 'Selected' is selected.</li>
    <li>Safari 6: 'Selected' is selected.</li>
</ul>

<p>3. Removing selected HTML attribute:<br/>
    <select size=4><option id=o3 selected>Option</option></select>
    <script>
        $('o3').removeAttribute('selected');
    </script>
</p>
<ul>
    <li>Chrome 30: 'Option' is selected.</li>
    <li>Firefox 24: 'Option' is not selected.</li>
    <li>IE 11: 'Option' is selected.</li>
    <li>Safari 6: 'Option' is not selected.</li>
</ul>

<p>4. Adding selected HTML attribute to an OPTION of which selected IDL attribute was updated:<br/>
    <select size=4><option id=o4>Option</option></select>
    <script>
        $('o4').selected = true;
        $('o4').selected = false;
        $('o4').setAttribute('selected', 'selected');
    </script>
</p>
<ul>
    <li>Chrome 30: 'Option' is selected.</li>
    <li>Firefox 24: 'Option' is not selected.</li>
    <li>IE 11: 'Option' is not selected.</li>
    <li>Safari 6: 'Option' is selected.</li>
</ul>

<p>5. Removing selected HTML attribute from an OPTION of which selected IDL attribute was updated: <span class="ok">(browsers agree)</span><br/>
    <select size=4><option id=o5...

CSS

.ok { color: lime }