In a view, in this case on a page display, page details set as table.

Content for fields is modified to include first name and last name in the last name field's REWRITE RESULTS.
[field_first_name] [field_last_name]

Style settings are thus:

Style Settings
[X]Customize field HTML
	HTML element
		[ SPAN ]
	[X] Create a CSS class
		CSS class
		[ full-name-altered ]
		You may use token substitutions from the 
		rewriting section in this class

Set css to:

.full-name-altered {
	font-size: 1.5em;
	font-weight: bold;
}

Expected to see this source code on render:

<td class="views-field views-field-field-last-name">
<span class="full-name-altered">LaWanda Jones</span>
</td>

Got this source code on render:

<td class="views-field views-field-field-last-name full-name-altered">
<span>LaWanda Jones</span>
</td>

The only way I can get it do provide the expected source code is to uncheck 'Customize field HTML' and put the following in REWRITE RESULTS:
<span class="full-name-altered">[field_first_name] [field_last_name]</span>

I wouldn't have noticed it if I hadn't check the source. It renders the way I expect, but what's the point of the span if it's not used as the expected css wrapper? Is this not a bug?

Comments

dawehner’s picture

Status: Active » Fixed

That's actually intended in the table style plugin, sorry.

Remove senseless tags.

gr33nman’s picture

dawehner, thanks for your reply.
Just to be clear... Will this remain as-is, in essence meaning I've misunderstood how to use a 'feature' that is not a 'bug', or has it been fixed so that the behavior will give the views user the expected experience?

merlinofchaos’s picture

"The expected" is a misleading phrase. That's your expectation, but that is not everybody's expectation.

Tables very specifically put the field class on the TD tag.

Because if the hierarchical nature of CSS, this shouldn't really be a problem, should it? In MOST use cases, the TD tag is where the class is wanted when using tables.

merlinofchaos’s picture

BTW what I mean about the CSS is this:

td.full-name-altered span {
	font-size: 1.5em;
	font-weight: bold;
}
merlinofchaos’s picture

Status: Fixed » Closed (works as designed)

Oh, and one addendum: If we didn't put the class on the TD tag, you wouldn't be able to add CSS to the TD at all. Whereas with this method, you can CSS either one however you like.