Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to solve following problems:
cause the element to be always checked independently of previously saved value. Similarly, setting
id
attribute cause some problem on labels handling and so on.This is because extra HTML attributes are printed out before
id
andchecked
.avoid duplication of attributes by setting attributes like
class
,type
,name
,id
,value
,checked
and somedata-*
. In HTML5 it's not allowed to have two or more identical attributes on the same tag. What happens in practice is that browsers ignore the latter attribute. Well, future browsers might do otherwise (that is, the parser is allowed to stop when it encounters an error).This was done by adding an attributes black list to
get_element_attributes()
.allow to add classes to
class
attribute of field itself (not only to his container).This can be useful in some situation if you want to reuse of CSS classes without adding the same rules in specific selectors. In practice:
will append
my-class
to element class.PS: I added unit tests only to checkbox field (I think is sufficiently, but I can add to others too).