{"action":"created","issue":{"url":"https://api.github.com/repos/thymeleaf/thymeleaf/issues/578","repository_url":"https://api.github.com/repos/thymeleaf/thymeleaf","labels_url":"https://api.github.com/repos/thymeleaf/thymeleaf/issues/578/labels{/name}","comments_url":"https://api.github.com/repos/thymeleaf/thymeleaf/issues/578/comments","events_url":"https://api.github.com/repos/thymeleaf/thymeleaf/issues/578/events","html_url":"https://github.com/thymeleaf/thymeleaf/issues/578","id":212398353,"number":578,"title":"Adding a custom value to \"selected\" attribute is not possible","user":{"login":"david-dogneton","id":6921445,"avatar_url":"https://avatars0.githubusercontent.com/u/6921445?v=3","gravatar_id":"","url":"https://api.github.com/users/david-dogneton","html_url":"https://github.com/david-dogneton","followers_url":"https://api.github.com/users/david-dogneton/followers","following_url":"https://api.github.com/users/david-dogneton/following{/other_user}","gists_url":"https://api.github.com/users/david-dogneton/gists{/gist_id}","starred_url":"https://api.github.com/users/david-dogneton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-dogneton/subscriptions","organizations_url":"https://api.github.com/users/david-dogneton/orgs","repos_url":"https://api.github.com/users/david-dogneton/repos","events_url":"https://api.github.com/users/david-dogneton/events{/privacy}","received_events_url":"https://api.github.com/users/david-dogneton/received_events","type":"User","site_admin":false},"labels":[{"id":72079070,"url":"https://api.github.com/repos/thymeleaf/thymeleaf/labels/tracker:question","name":"tracker:question","color":"9b7a04","default":false}],"state":"closed","locked":false,"assignee":{"login":"danielfernandez","id":1492299,"avatar_url":"https://avatars0.githubusercontent.com/u/1492299?v=3","gravatar_id":"","url":"https://api.github.com/users/danielfernandez","html_url":"https://github.com/danielfernandez","followers_url":"https://api.github.com/users/danielfernandez/followers","following_url":"https://api.github.com/users/danielfernandez/following{/other_user}","gists_url":"https://api.github.com/users/danielfernandez/gists{/gist_id}","starred_url":"https://api.github.com/users/danielfernandez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielfernandez/subscriptions","organizations_url":"https://api.github.com/users/danielfernandez/orgs","repos_url":"https://api.github.com/users/danielfernandez/repos","events_url":"https://api.github.com/users/danielfernandez/events{/privacy}","received_events_url":"https://api.github.com/users/danielfernandez/received_events","type":"User","site_admin":false},"assignees":[{"login":"danielfernandez","id":1492299,"avatar_url":"https://avatars0.githubusercontent.com/u/1492299?v=3","gravatar_id":"","url":"https://api.github.com/users/danielfernandez","html_url":"https://github.com/danielfernandez","followers_url":"https://api.github.com/users/danielfernandez/followers","following_url":"https://api.github.com/users/danielfernandez/following{/other_user}","gists_url":"https://api.github.com/users/danielfernandez/gists{/gist_id}","starred_url":"https://api.github.com/users/danielfernandez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielfernandez/subscriptions","organizations_url":"https://api.github.com/users/danielfernandez/orgs","repos_url":"https://api.github.com/users/danielfernandez/repos","events_url":"https://api.github.com/users/danielfernandez/events{/privacy}","received_events_url":"https://api.github.com/users/danielfernandez/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/thymeleaf/thymeleaf/milestones/11","html_url":"https://github.com/thymeleaf/thymeleaf/milestone/11","labels_url":"https://api.github.com/repos/thymeleaf/thymeleaf/milestones/11/labels","id":213281,"number":11,"title":"Thymeleaf 3.0","description":"","creator":{"login":"danielfernandez","id":1492299,"avatar_url":"https://avatars0.githubusercontent.com/u/1492299?v=3","gravatar_id":"","url":"https://api.github.com/users/danielfernandez","html_url":"https://github.com/danielfernandez","followers_url":"https://api.github.com/users/danielfernandez/followers","following_url":"https://api.github.com/users/danielfernandez/following{/other_user}","gists_url":"https://api.github.com/users/danielfernandez/gists{/gist_id}","starred_url":"https://api.github.com/users/danielfernandez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielfernandez/subscriptions","organizations_url":"https://api.github.com/users/danielfernandez/orgs","repos_url":"https://api.github.com/users/danielfernandez/repos","events_url":"https://api.github.com/users/danielfernandez/events{/privacy}","received_events_url":"https://api.github.com/users/danielfernandez/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":213,"state":"open","created_at":"2012-11-14T23:08:17Z","updated_at":"2017-03-07T22:21:39Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2017-03-07T10:59:35Z","updated_at":"2017-03-07T22:21:39Z","closed_at":"2017-03-07T22:21:39Z","body":"I am using Polymer's [paper-tabs](https://www.webcomponents.org/element/PolymerElements/paper-tabs/paper-tabs). \r\n\r\nIt uses the `selected` attribute to choose the default tab to display. \r\nIt could be a string or a number (the tab index). \r\n\r\nI want to change the `selected` attribute value through Thymeleaf but it always set the value to `\"selected\"`, probably to comply with the `<option>` [selected attribute](https://www.w3schools.com/tags/att_option_selected.asp). \r\n\r\nIs it possible to have a custom value like `<paper-tabs selected=\"2\">` ?\r\nCurrently, `th:selected=\"2\"` leads to `<paper-tabs selected=\"selected\">`"},"comment":{"url":"https://api.github.com/repos/thymeleaf/thymeleaf/issues/comments/284879335","html_url":"https://github.com/thymeleaf/thymeleaf/issues/578#issuecomment-284879335","issue_url":"https://api.github.com/repos/thymeleaf/thymeleaf/issues/578","id":284879335,"user":{"login":"danielfernandez","id":1492299,"avatar_url":"https://avatars0.githubusercontent.com/u/1492299?v=3","gravatar_id":"","url":"https://api.github.com/users/danielfernandez","html_url":"https://github.com/danielfernandez","followers_url":"https://api.github.com/users/danielfernandez/followers","following_url":"https://api.github.com/users/danielfernandez/following{/other_user}","gists_url":"https://api.github.com/users/danielfernandez/gists{/gist_id}","starred_url":"https://api.github.com/users/danielfernandez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielfernandez/subscriptions","organizations_url":"https://api.github.com/users/danielfernandez/orgs","repos_url":"https://api.github.com/users/danielfernandez/repos","events_url":"https://api.github.com/users/danielfernandez/events{/privacy}","received_events_url":"https://api.github.com/users/danielfernandez/received_events","type":"User","site_admin":false},"created_at":"2017-03-07T22:21:39Z","updated_at":"2017-03-07T22:21:39Z","body":"You are right, `th:selected` is meant to model the HTML `selected` attribute, which according to the HTML spec is a *boolean* attribute. This means that it can either be present or not, but no value is expected for it. The `selected=\"selected\"` is the standard value given in order to be friendly to XHTML processors, and together with the empty string is the only value allowed for an HTML *boolean* attribute. That's why Thymeleaf is automatically *fixing* your value.\r\n\r\nHowever in this case the `selected` you need is not HTML's, but an attribute with the same (*unfortunately chosen?*) name used by a Polymer component in an HTML environment.\r\n\r\nIn order to work around the collision, and assuming you are using Thymeleaf 3.0, you'll have to switch the *template mode* for that template or fragment: either go for `XML` (which would make you lose some HTML-oriented goodies in Thymeleaf — anyway might not be an issue) or directly to `TEXT`, which would make it work more like JSP or FreeMarker, and not mind at all about your code being HTML or not. Actually, according to the code samples in the page you link this might be a safer option given that code isn't actually valid HTML5 (those custom tag and attribute names do not follow the HTML5 spec…)\r\n\r\nI'll be closing this for now. Please reopen if you have any further issues with this."}}
{"actor":{"display_login":"danielfernandez"}}