yanwong / ganon

Automatically exported from code.google.com/p/ganon
0 stars 0 forks source link

Unable to set the disabled attribute of an input tag in a valid way #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Setting the disabled attribute of an input tag like as follows

$node->disabled = 'disabled';

results in the output: <input disabled="">
NOTE: the value is not inserted.

where as if you do the following:

$node->disabled = 1;

the result output is: <input disabled="1">
NOTE: the value is inserted.

The problem is the '$this->attributes[$a] !== $a' check at line 337 within the 
HTML_Node::toString_attributes() method in gan_node_html.php 

This check stops an attribute name being the same as the attribute's value, but 
in the case of disabled="disabled" this is required.

This happens in rev72

Original issue reported on code.google.com by david...@gmail.com on 20 Jul 2012 at 4:04

GoogleCodeExporter commented 8 years ago
Sorry for the late response, vacation got in the way.

If I do $node->disabled = 'disabled', output is <input disabled> (which should 
be a valid alternative to disabled=disabled?).

If you want to explicitly state disabled=disabled, you can set 
attribute_shorttag to false:
  $node->attribute_shorttag = false;
  $node->disabled = 'disabled';
gives
  <input disabled="disabled">

Do you think this behaviour should be changed? If so, what do you propose?

Original comment by niels....@gmail.com on 7 Aug 2012 at 9:11

GoogleCodeExporter commented 8 years ago

Original comment by niels....@gmail.com on 7 Aug 2012 at 9:11

GoogleCodeExporter commented 8 years ago
You can open a new issue for a proposal if you want.

Original comment by niels....@gmail.com on 14 Aug 2012 at 6:30