adhocracy3
adhocracy3 copied to clipboard
Widget parameter noheader cannot be set to false
When having data-noheader="false"
in the embed-code the header is not shown.
Only removing the data-noheader
parameter enables the header.
This is not properly documented, but it is actually how the embed API works: If the attribute is specified the value is true
, if it is not specified the value is false
. This is consistent with boolean attributes in HTML.
However, this mechanism is only used for nocenter
and noheader
. autoresize
and autourl
are converted to boolean by jquery. The defaults are true
for autoresize
and false
for autourl
.
So I see two issues here:
- The documentation is not clear
- The behavior is inconsistent
Fixing this inconsistency would actually break a public API, so we should be very careful about it. I see three options:
- Changing the behavior of
autoresize
andautourl
. This would be a big problem because the usage ofautoresize="false"
is actually recommended for plain embeds in the docs. (value = data.hasOwnProperty("key")
) - Changing the behavior of
nocenter
andnoheader
. This would be a smaller issue: The most probable issue is that the attribute might have been used without a value or with an empty value. It is quite possible that this is not the case. However, the implementation would be difficult because we generally avoid using jquery. (value = $element.data("key")
) - Changing both. Any case except for no attribute or a value of
false
would be interpreted as true. This would only break theautoresize
default value. (value = data.hasOwnProperty("key") && data["key"] !== "false"
)
I am not happy with any of these solutions. If I had to choose it would be either 2 or 3.
I am in favor of 2, as it would make the parameter usage consistent and would break less than 1.