Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-07-01 09:24:05

planeth
Plugin Author
From: Nantes, France
Registered: 2009-03-19
Posts: 234
Website GitHub Mastodon

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

#2 2014-07-01 09:34:53

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,446
Website GitHub

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

#3 2014-07-01 10:31:30

planeth
Plugin Author
From: Nantes, France
Registered: 2009-03-19
Posts: 234
Website GitHub Mastodon

Re: tag_void strip attribute=0 bug or feature ?

You’re welcome :)

Offline

#4 2014-07-08 12:29:54

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: tag_void strip attribute=0 bug or feature ?

Bloke wrote #281792:

I’d say bug. Thanks for the report.

Intentional. It’s for backwards compatibility.

Offline

#5 2014-07-08 13:03:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,446
Website GitHub

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

Board footer

Powered by FluxBB