Skip to content

Commit

Permalink
Item13331: Don't emit empty id= or style=
Browse files Browse the repository at this point in the history
id must be unique if provided,  empty elements fail HTML validation.
empty style= was breaking unit tests.
  • Loading branch information
gac410 committed Apr 19, 2015
1 parent c603a28 commit ff61aa2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions UnitTestContrib/test/unit/ViewScriptTests.pm
Expand Up @@ -34,10 +34,12 @@ my $topic2meta =
'%META:TOPICINFO{author="BaseUserMapping_666" date="[0-9]{10,10}" format="1.1" version="1"}%'
. "\n";
my $topic2metaQ = $topic2meta;
$topic2metaQ =~ s/"/"/g;
$topic2metaQ = Foswiki::entityEncode($topic2metaQ);

#$topic2metaQ =~ s/"/"/g;

my $topic2txtarea =
"<textarea class='foswikiTextarea foswikiTextareaRawView' cols='70' readonly='readonly' rows='22' style='width:99%' id='topic'>";
"<textarea rows='22' cols='70' class='foswikiTextarea foswikiTextareaRawView' name='' id='topic' readonly style='width:99%'>";

my $topic2rawON = $topic2;
$topic2rawON =~ s/</&lt;/g;
Expand Down
2 changes: 2 additions & 0 deletions core/lib/Foswiki/Render/HTML.pm
Expand Up @@ -131,6 +131,8 @@ sub _replaceTokens {
chop $token;
$repl = Foswiki::entityEncode($repl);
}
$tmpl =~ s/id='%ID%'// if ( $token eq 'ID' && !length($repl) );
$tmpl =~ s/style='%STYLE%'// if ( $token eq 'STYLE' && !length($repl) );
$tmpl =~ s/%$token%/$repl/;
}

Expand Down

0 comments on commit ff61aa2

Please sign in to comment.