Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
tag_void strip attribute=0 bug or feature ?
Hello dear devs,
(using txp v4.6-dev)
When calling tag_void('input', array('type' => "number", 'min" => "0"))
the output is <input type="number" />
min attribute get stripped away.
I understand it has to do the flag ATTS_STRIP_EMPTY.
I found a workaround using : tag_void('input', array('type' => "number", 'min" => array("0")))
So as in title : is it a bug or a feature ?
Last edited by planeth (2014-07-01 09:25:33)
Offline
Re: tag_void strip attribute=0 bug or feature ?
planeth wrote #281790:
So as in title : is it a bug or a feature ?
I’d say bug. Thanks for the report.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: tag_void strip attribute=0 bug or feature ?
You’re welcome :)
Offline
Offline
Re: tag_void strip attribute=0 bug or feature ?
Gocom wrote #282001:
Intentional. It’s for backwards compatibility.
Drat.
So what are the ramifications of changing it then? What will happen to people’s pages? Why was omitting zero-based attributes (even in older code bases) not considered a bug? I’m probably being dim, but I can’t think of a use case right now where you’d want it to be omitted. Setting min="0"
, for example, seems like a valid thing to do, albeit we don’t (currently) have any tags or code that output a zero attribute value.
Potentially, plugins such as zem_contact_reborn will use the core’s widget library to generate its markup, so will that require the workaround that planeth posted?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline