php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74992 wrong behaviour for attribute "selected"
Submitted: 2017-07-26 09:49 UTC Modified: 2017-07-26 12:25 UTC
From: yuriy at vihv dot org Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 7.0.21 OS: Linux Fedora 24.x86_64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: yuriy at vihv dot org
New email:
PHP Version: OS:

 

 [2017-07-26 09:49 UTC] yuriy at vihv dot org
Description:
------------
during transformation to XML attribute "selected" always set to empty string.
That might be ok for trasformation to HTML, but for XML it's wrong.

If I rename attribute - all works as expected.
Also on earlier version selected works just fine.

 

Test script:
---------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="no"/>
    <xsl:template name="selectTemplate">
        <select>
           <option value="123" selected="selected">value</option>
        </select>
    </xsl:template>
</xsl:stylesheet>

Expected result:
----------------
Correct XHTML will be

<select>
    <option value="123" selected="selected">value</option>
</select>

or at least it should be correct HTML5

<select>
    <option value="123" selected>value</option>
</select>

Actual result:
--------------
<select>
   <option value="123" selected="">value</option>
</select>

Firefox treat this element as NOT selected

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-26 10:03 UTC] yuriy at vihv dot org
Oopps, sorry, that's firefox problem. Firebug showed 'selected=""' but source codes as text are correct, just "selected".

Sorry for bothering you.
 [2017-07-26 12:25 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2017-07-26 12:25 UTC] requinix@php.net
as commented
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC