You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Alexandru Objelean (JIRA)" <ji...@apache.org> on 2007/09/21 15:14:50 UTC

[jira] Created: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

getMarkupId generates ID which contains special characters which should be escaped or replaced
----------------------------------------------------------------------------------------------

                 Key: WICKET-995
                 URL: https://issues.apache.org/jira/browse/WICKET-995
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.0-beta3
            Reporter: Alexandru Objelean


This is about how wicket generates dynamically markupID.

I have, for instance, the following markup component:
<input wicket:id="quantity.noOfUnits" />

The generated markupId for this component looks like the following: quantity.noOfUnits1232 .

I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).

The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-995.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.0-beta4

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530160 ] 

Igor Vaynberg commented on WICKET-995:
--------------------------------------

hrm, i already made this change!

ryan, start a vote on the list to have it undone. i dont really care either way because these ids are automatically generated anyways.

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Ryan Holmes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530059 ] 

Ryan Holmes commented on WICKET-995:
------------------------------------

The period is a valid character in an HTML ID. See http://www.w3.org/TR/html4/types.html#type-id.

To refer to an HTML ID with a period in a CSS selector context, the period must be escaped. If JQuery does not support this, it is a JQuery bug and should be filed with them.

The automatic transformation of certain characters by a framework is exactly the kind of magic behavior that confuses users and therefore I think the recommended "fix" is a bad idea.

Furthermore, since no actual bug has been reported here, this issue should probably be resolved as invalid.




> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Alexandru Objelean (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530392 ] 

Alexandru Objelean commented on WICKET-995:
-------------------------------------------

Well, I did bother to read the w3c specification... As you can read above, I didn't suggest to replace the '.' character with an underscore '_' mandatory, it could be replaced with a number or another character (anything that is still valid). 
Also, before creating this JIRA issue, I asked Matej if he considered it to be a bug. Igor also thought that this issue can be fixed without any problems since he fixed it already.
I'm still not convinced that changing the generated markup id is a dangerous thing, maybe you can give me an example?

I propose to make a vote between the core developers, since there are two different points of view.

PS: I do not insist on this issue to be fixed, I just think that it would solve a real world related problem without causing any troubles to anybody else.

Alex

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-995:
------------------------------------

    Assignee: Igor Vaynberg

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Alexandru Objelean (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530398 ] 

Alexandru Objelean commented on WICKET-995:
-------------------------------------------

Wicket already does a lot of magic, because it generates unique markup id by appending some number. The way I see the purpose of Component#getMarkupId method is to ensure that the element ID is really unique. Thus, it doesn't matter if I have "field.index" or "field_index" because the generated markupID will be different for each component (for instance: filed_index123 & field_index124).

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Alexandru Objelean (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530514 ] 

Alexandru Objelean commented on WICKET-995:
-------------------------------------------

In wicket-1.3.x branch the underscore is not used as a hierarchy separator. I

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Ryan Holmes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530488 ] 

Ryan Holmes commented on WICKET-995:
------------------------------------

To expand on Gwyn's second point, another potential issue could arise if you have a component with id "field" that has a child "index" plus a component with id "field.index" at the same level as "field", due to the use of '_' as a hierarchy separator in markup id's.

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Frank Bille Jensen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frank Bille Jensen updated WICKET-995:
--------------------------------------

    Fix Version/s:     (was: 1.3.0-beta4)
                   1.3.0-beta5

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta5
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Ryan Holmes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530497 ] 

Ryan Holmes commented on WICKET-995:
------------------------------------

On second thought, the issue I described above could occur right now, since you can use '_' in a component id (plus I hadn't read Igor's latest comment). Perhaps a substitution character other than '_' should be considered.

I have to bring up one more criticism though. If this is a good idea, shouldn't Wicket also transform other characters that could be confusing, although legal, in a CSS context? For example, a space.

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Gwyn Evans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530397 ] 

Gwyn Evans commented on WICKET-995:
-----------------------------------

My view is that we shouldn't be doing any 'magic' that we can avoid, and this looks to me that to be one that we can avoid, as the '.' appears to be valid in this position, so I'm a bit concerned about this on two levels - For the second, could there be issues if the HTML author has two id's "field.index" and "field_index", for instance?



> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530449 ] 

Igor Vaynberg commented on WICKET-995:
--------------------------------------

@martijn: actually the underscore in the id is not a problem as the first thing the code does is escape an underscore with two underscores. give me a bit of credit :)

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-995.
----------------------------------

    Resolution: Fixed

closing for now. i think the way it works currently is good enough for 1.3

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta5
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Alexandru Objelean (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530369 ] 

Alexandru Objelean commented on WICKET-995:
-------------------------------------------

I agree with Alastair. A developer cannot confused by something that is generated automatically. Nobody really cares if the generated markup ID is "quantity1",  "quantity_1", "quantity.1" or "quantity-1".

Also, it's not a jquery bug at all. The '.' character is interpreted as a css class. So, the $("#quantity.noOfUnits1232") translates in element with ID "quantity" and css class "noOfUnits1232".



> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Martijn Dashorst (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martijn Dashorst reopened WICKET-995:
-------------------------------------


I agree with Ryan, see my previous comment

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530166 ] 

Alastair Maw commented on WICKET-995:
-------------------------------------

I think we should keep it - it won't hurt anyone and will work around "bugs" in frameworks like JQuery that are probably rather common.

> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-995) getMarkupId generates ID which contains special characters which should be escaped or replaced

Posted by "Martijn Dashorst (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530386 ] 

Martijn Dashorst commented on WICKET-995:
-----------------------------------------

Repeating that something is not a bug is not making it more true. Alex have you even bothered to read http://www.w3.org/TR/html4/types.html#type-id ?

The specification of HTML and CSS are clearly in conflict: the "." *IS* a valid character in markup ID's. You can look it up.

Furthermore, #foo.bar does not point to element foo with class bar, it points to element foo, or at least it should: the class is extra garbage that should not be included if the developer is worth his money.

So in effect JQuery, you, the CSS committee, the world and the universe are buggy.

That said: replacing the period with a _ *IS* dangerous as it will generate quite some buggy code in the wicket case. An underscore character is a valid Java character for names of properties. There are (gak!) people that don't use camelcase, but underscores to separate proper nouns in propertynames. This clearly is not a two way conversion, and therefore should not be used as a conversion for the separation between properties.


> getMarkupId generates ID which contains special characters which should be escaped or replaced
> ----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-995
>                 URL: https://issues.apache.org/jira/browse/WICKET-995
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Alexandru Objelean
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.0-beta4
>
>
> This is about how wicket generates dynamically markupID.
> I have, for instance, the following markup component:
> <input wicket:id="quantity.noOfUnits" />
> The generated markupId for this component looks like the following: quantity.noOfUnits1232 .
> I suggest to escape any css valid specifiers from the generated markupId, by replacing them with something else (for instance '_' character).
> The problem appear when I am trying to identify the component by it's id using some js library (like jQuery) and as a consequence the result of this query: $("#quantity.noOfUnits1232") is invalid. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.