diem-project/symfony — Issue #3: Cannot extract new html5 attribute data-role
Author: arnaudgaudin
Created: 2011-12-19 11:29:17+00:00
State: open

The function sfToolkit::stringToArray is used to get the element properties in a jQuery way.

But the way the key of the attribute is extracted cannot handle the new html5 attribute data-role. The dash in the property is ignored, so the resulting attribute is wrong.

For example the following string '#myID.myClass data-role="content"' get the following properties :

id="myID"
class="myClass"
role="content"

As you can see the attribute "data-role" is evaluated as "role".

I have made a code modification in the stringToArray function to solve this issue. It would be great if it could be implemented.

Here is my code modification :

sfToolkit.class.php , function stringToArray line 277 :

Original :
\s*(\w+) # key

Modified :
\s*(\w*\-*\w+) # key

As you can see I have juste added the following \w*\-* to get the property data-role to be evaluated.

Sorry if my english is not perfect, it is not my native language.

What do you think of this issue ?