<b> tag in HTML 5 (was Re: [Rails] Re: assert_select for <p><b>text</b>value</p>)

8 views
Skip to first unread message

Chris Mear

unread,
Aug 30, 2010, 11:44:44 AM8/30/10
to rubyonra...@googlegroups.com
On 30 August 2010 15:47, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
> Colin Law wrote:
>> I have the following html
>> <p><b>text</b>value</p>
>> I can use
>> assert_select "p>b", "text"
>> to check the text portion, and
>> assert_select "p", "value"
>> to check that the value appears in a <p>.  I cannot work out how to
>> check that the two are in the same <p>.  I have used assert_select for
>> much more complex tasks but my mind seems to have gone blank and
>> google has not provided an example of this type.
>>
>> Any help would be much appreciated.
>
> First off: you shouldn't ever be using <b> tags.  That's 1990s physical
> styling.  That's *bad*.  You should be using a semantically named <span>
> instead.  But you probably knew that already.

Actually, it's back in in HTML5...

http://dev.w3.org/html5/spec/Overview.html#the-b-element

Everything old is new again.

Chris

Marnen Laibow-Koser

unread,
Aug 30, 2010, 12:18:52 PM8/30/10
to rubyonra...@googlegroups.com

I didn't say it was invalid HTML. I said it was *bad practice*.

> Chris

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
--
Posted via http://www.ruby-forum.com/.

Colin Law

unread,
Aug 30, 2010, 12:49:18 PM8/30/10
to rubyonra...@googlegroups.com

Though actually I think my use case is not such as described there, it
being a list of column names (bold) and values, generated by a Rails
scaffold some years ago.

Colin

Colin Law

unread,
Aug 30, 2010, 12:48:27 PM8/30/10
to rubyonra...@googlegroups.com
On 30 August 2010 16:44, Chris Mear <chri...@gmail.com> wrote:

Though actually I think my use case is not such as described there, it

Marnen Laibow-Koser

unread,
Aug 30, 2010, 1:02:47 PM8/30/10
to rubyonra...@googlegroups.com
Colin Law wrote:
> On 30 August 2010 16:44, Chris Mear <chri...@gmail.com> wrote:
>>>> much more complex tasks but my mind seems to have gone blank and
>> http://dev.w3.org/html5/spec/Overview.html#the-b-element
>>
>> Everything old is new again.
>
> Though actually I think my use case is not such as described there, it
> being a list of column names (bold) and values, generated by a Rails
> scaffold some years ago.

Then you absolutely should not be using <b>. Use something semantic
instead, or if your design supports it, recast the whole thing into a
<table> and use <th> and <td> (which is what I'd normally do). The
semantics are tabular, so a <table> element would be quite appropriate.

>
> Colin

Bill Walton

unread,
Aug 30, 2010, 1:14:39 PM8/30/10
to rubyonra...@googlegroups.com
On Mon, Aug 30, 2010 at 11:24 AM, Greg Donald <gdo...@gmail.com> wrote:

> On Mon, Aug 30, 2010 at 11:18 AM, Marnen Laibow-Koser
> <li...@ruby-forum.com> wrote:
>> I didn't say it was invalid HTML.  I said it was *bad practice*.
>
> Yeah, that's why it's in the spec, 'cause no one should use it.
>
> /rolls eyes

+1. If only marnen were in charge.... ;-)

Marnen Laibow-Koser

unread,
Aug 30, 2010, 1:23:09 PM8/30/10
to rubyonra...@googlegroups.com

The HTML 5 spec itself says <b> is only to be used as a last resort if
no other element is more appropriate. IMHO, that's never the case: even
if nothing more specific can be found, <span> is more appropriate than
<b>.

I assume <b> is in the spec for backward compatibility with legacy
markup.

One more time: I didn't say <b> is invalid. I didn't say <b> should be
removed from the spec. I didn't say I wanted to be in charge of the
HTML 5 spec. I said <b> is bad practice and should be avoided. I stand
by that statement.

Greg Donald

unread,
Aug 30, 2010, 12:24:03 PM8/30/10
to rubyonra...@googlegroups.com
On Mon, Aug 30, 2010 at 11:18 AM, Marnen Laibow-Koser
<li...@ruby-forum.com> wrote:
> I didn't say it was invalid HTML.  I said it was *bad practice*.

Yeah, that's why it's in the spec, 'cause no one should use it.

/rolls eyes

--
Greg Donald
destiney.com | gregdonald.com

Robert Walker

unread,
Aug 30, 2010, 3:19:29 PM8/30/10
to rubyonra...@googlegroups.com
Marnen Laibow-Koser wrote:
> Bill Walton wrote:
>> On Mon, Aug 30, 2010 at 11:24 AM, Greg Donald <gdo...@gmail.com> wrote:
>>> On Mon, Aug 30, 2010 at 11:18 AM, Marnen Laibow-Koser
>>> <li...@ruby-forum.com> wrote:
>>>> I didn't say it was invalid HTML. �I said it was *bad practice*.
>>>
>>> Yeah, that's why it's in the spec, 'cause no one should use it.
>>>
>>> /rolls eyes
>>
>> +1. If only marnen were in charge.... ;-)
>
> The HTML 5 spec itself says <b> is only to be used as a last resort if
> no other element is more appropriate. IMHO, that's never the case: even
> if nothing more specific can be found, <span> is more appropriate than
> <b>.

I have to agree with Marnen. Are we criticizing people for emphasizing
exactly what the HTML5 spec states now?

I agree that <b> is maintained in the spec solely for backward
compatibility. I see no use case for a "proper" use of <b>. That tag
suggests too specific a styling (boldened). As recommended by the spec
<strong>, <em> or <mark> are more appropriate in most cases.

Here is the <strong>incorrect</strong> example presented in the spec:

<p><b>WARNING!</b> Do not frob the barbinator!</p>

In the above case the appropriate tag would be <strong> not <b>.

The <strong> tag suggests "WARNING!" should be presented "strongly"
without specifically suggesting "boldened." That may mean, "Display
WARNING! in yellow (and bold too)."

Bill Walton

unread,
Aug 30, 2010, 3:48:02 PM8/30/10
to rubyonra...@googlegroups.com
On Mon, Aug 30, 2010 at 2:19 PM, Robert Walker <li...@ruby-forum.com> wrote:
> Marnen Laibow-Koser wrote:
>> Bill Walton wrote:
>>> On Mon, Aug 30, 2010 at 11:24 AM, Greg Donald <gdo...@gmail.com> wrote:
>>>> On Mon, Aug 30, 2010 at 11:18 AM, Marnen Laibow-Koser
>>>> <li...@ruby-forum.com> wrote:
>>>>> I didn't say it was invalid HTML. �I said it was *bad practice*.
>>>>
>>>> Yeah, that's why it's in the spec, 'cause no one should use it.
>>>>
>>>> /rolls eyes
>>>
>>> +1.  If only marnen were in charge....  ;-)
>>
>> The HTML 5 spec itself says <b> is only to be used as a last resort if
>> no other element is more appropriate.  IMHO, that's never the case: even
>> if nothing more specific can be found, <span> is more appropriate than
>> <b>.
>
> I have to agree with Marnen. Are we criticizing people for emphasizing
> exactly what the HTML5 spec states now?

Speaking for myself, I am criticizing marnen's obnoxious and
judgmental posts. A post such as yours that takes the time to explain
to a poster why one approach is favored over another is welcome,
"that's bad" is simply an unsubstantiated opinion. If he's not going
to provide assistance, he should either keep his mouth shut or be
ready to be chastised / derided in the same manner he treats others.

Greg Donald

unread,
Aug 30, 2010, 2:45:29 PM8/30/10
to rubyonra...@googlegroups.com
On Mon, Aug 30, 2010 at 12:23 PM, Marnen Laibow-Koser
<li...@ruby-forum.com> wrote:
>> +1.  If only marnen were in charge....  ;-)
>
> The HTML 5 spec itself says <b> is only to be used as a last resort if
> no other element is more appropriate.  IMHO, that's never the case:

So go get yourself on the HTML5 committee, you can help them un-think
that last resort case they thought of.

> even
> if nothing more specific can be found, <span> is more appropriate than
> <b>.

Because it's always more appropriate to type more than you have to?

<b>foo</b>

<span>foo</span>

span{font-weight:bold;}

Marnen Laibow-Koser

unread,
Aug 30, 2010, 4:03:58 PM8/30/10
to rubyonra...@googlegroups.com
Bill Walton wrote:
> On Mon, Aug 30, 2010 at 2:19 PM, Robert Walker <li...@ruby-forum.com>
> wrote:
>>>>
>>>> +1.  If only marnen were in charge....  ;-)
>>>
>>> The HTML 5 spec itself says <b> is only to be used as a last resort if
>>> no other element is more appropriate.  IMHO, that's never the case: even
>>> if nothing more specific can be found, <span> is more appropriate than
>>> <b>.
>>
>> I have to agree with Marnen. Are we criticizing people for emphasizing
>> exactly what the HTML5 spec states now?
>
> Speaking for myself, I am criticizing marnen's obnoxious and
> judgmental posts.

I didn't intend to be obnoxious. I *did* intend to be judgmental of bad
practice.

> A post such as yours that takes the time to explain
> to a poster why one approach is favored over another is welcome,
> "that's bad" is simply an unsubstantiated opinion.

I explained my rationale in an earlier post. You appatently neither
read it nor asked for the clarification which I would have been happy to
reiterate if requested. This is not the first time that you've taken me
to task for supposedly failing to provide information that I in fact
provided.

Legitimate criticism is welcome. But if you can't bother to check that
the criticism is borne out by the facts, then please don't bother to
post it.

> If he's not going
> to provide assistance, he should either keep his mouth shut or be
> ready to be chastised / derided in the same manner he treats others.

I provide lots of assistance, and regularly get thanked for it. If
you're going to criticize something about my posts, please make sure the
criticism actually applies. In this case, your stated criticism was
simply inaccurate.

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Sent from my iPhone

Greg Donald

unread,
Aug 30, 2010, 3:52:00 PM8/30/10
to rubyonra...@googlegroups.com
On Mon, Aug 30, 2010 at 2:48 PM, Bill Walton <bwalt...@gmail.com> wrote:
> Speaking for myself, I am criticizing marnen's obnoxious and
> judgmental posts.  A post such as yours that takes the time to explain
> to a poster why one approach is favored over another is welcome,
> "that's bad" is simply an unsubstantiated opinion.  If he's not going
> to provide assistance, he should either keep his mouth shut or be
> ready to be chastised / derided in the same manner he treats others.

Ditto.

Colin Law

unread,
Aug 30, 2010, 4:15:40 PM8/30/10
to rubyonra...@googlegroups.com
On 30 August 2010 18:02, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
> Colin Law wrote:
>> On 30 August 2010 16:44, Chris Mear <chri...@gmail.com> wrote:
>>>>> much more complex tasks but my mind seems to have gone blank and
>>> http://dev.w3.org/html5/spec/Overview.html#the-b-element
>>>
>>> Everything old is new again.
>>
>> Though actually I think my use case is not such as described there, it
>> being a list of column names (bold) and values, generated by a Rails
>> scaffold some years ago.
>
> Then you absolutely should not be using <b>.  Use something semantic
> instead, or if your design supports it, recast the whole thing into a
> <table> and use <th> and <td> (which is what I'd normally do).  The
> semantics are tabular, so a <table> element would be quite appropriate.

As I said before, I agree entirely. But as I also said before it is a
little used admin page and so improving the aesthetics of the html is
not the most important job at the moment.

Colin

Marnen Laibow-Koser

unread,
Aug 30, 2010, 4:50:46 PM8/30/10
to rubyonra...@googlegroups.com

I quite understand that, though at the same time I like to take a "fix
broken windows" approach -- that is, I like to fix obvious small
problems if I'm working on the file anyway.

> Colin

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Sent from my iPhone

Colin Law

unread,
Aug 30, 2010, 4:59:35 PM8/30/10
to rubyonra...@googlegroups.com
On 30 August 2010 21:50, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
> Colin Law wrote:
>> On 30 August 2010 18:02, Marnen Laibow-Koser <li...@ruby-forum.com>
>> wrote:
>>>
>>> Then you absolutely should not be using <b>. �Use something semantic
>>> instead, or if your design supports it, recast the whole thing into a
>>> <table> and use <th> and <td> (which is what I'd normally do). �The
>>> semantics are tabular, so a <table> element would be quite appropriate.
>>
>> As I said before, I agree entirely.  But as I also said before it is a
>> little used admin page and so improving the aesthetics of the html is
>> not the most important job at the moment.
>>
>
> I quite understand that, though at the same time I like to take a "fix
> broken windows" approach -- that is, I like to fix obvious small
> problems if I'm working on the file anyway.
>

Agreed again, I am not actually modifying that page, just adding a
test for a special case.

Cheers

Colin

Marnen Laibow-Koser

unread,
Aug 30, 2010, 10:51:12 PM8/30/10
to rubyonra...@googlegroups.com

Sure, that makes sense.

>
> Cheers
>
> Colin

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Reply all
Reply to author
Forward
0 new messages