Re: [css-d] IE7 wraping URLs at the ? part...

2008-01-02 Thread Jukka K. Korpela
Jukka K. Korpela wrote:

 If, for example, we have
 spanfoo izip zap/i bar/span
 and we assign white-space: nowrap to the span, then the effect
 should extend to the inner element's content zip zap as well.
 However, IE 7 breaks between zip and zap when it sees that fit.

I may have jumped into conclusions. When trying to describe the problem 
and its solution, I was unable to reproduce this bug. I suppose I found 
something real but in a special case I cannot find now.

 It appears that IE 7 implements td nowrap in a manner that does not
 quite correspond to a white-space: nowrap declaration for the cell
 element, as we might expect. It affects whitespace handling but not
 e.g. line breaks after ?.

I'm confused. Now that I test this, it seems that td nowrap does not 
work for a cell with a _fixed width_. Moreover, in that case, 
white-space: nowrap does not work either, when set on the cell element 
(td). But it works when set for, say, a span element inside the td 
element.

My test page: http://www.cs.tut.fi/~jkorpela/html/nobr-test.html

Jukka K. Korpela (Yucca)
http://www.cs.tut.fi/~jkorpela/ 

__
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/


Re: [css-d] IE7 wraping URLs at the ? part...

2007-12-28 Thread Jukka K. Korpela
Anthony Ettinger wrote:

 It works everywhere else (FF, Opera, Safari), but IE7 seems to not
 like the ? in a url, and wraps it within a table cell.

Stay tuned to seeing other browsers behave that way, too. According to 
Unicode line breaking rules, a break is permitted between a question 
mark ? and an alphabetic character, even when no space intervenes. 
Although HTML or CSS specifications do not require Unicode conformance, 
there seems to be a trend of changing browsers to apply some of the line 
breaking rules. This is a long story; see
http://www.cs.tut.fi/~jkorpela/html/nobr.html

In practice, this means that there will be more and more situations 
where you want to use either the nonstandard HTML markup 
nobr.../nobr or its CSS counterpart, white-space: nowrap, when your 
text contains special characters (or, as here, punctuation marks in 
contexts other those of a natural language). Despite the name, the 
white-space property affects line breaking in general, not just 
whitespace handling. (Even the CSS 2.1 draft says that This property 
declares how whitespace inside the element is handled, painting a wrong 
picture, but the description of the nowrap value says suppresses line 
breaks within text.)

 Markup is a cell in a table like this:

 td class=pana
 href=foo.com?long_url=herefoo.com?long_url=here/a/td

First of all, in practical terms, it might be best to avoid the problem. 
URLs should be avoided in document content, as opposite to normal 
descriptive link texts. But sometimes you wish to write _about_ URLs, 
and then you need to mention them.

 CSS is:

 td.pan { overflow: hidden; width: 12em; }
 td.pan  *:first-child { display: block; overflow: hidden; width:
 12em; }

Actually this doesn't quite the demonstrate the problem, since your 
sample URL is shorter than 12em, in any normal font. Anyone who wants to 
test your example needs to modify it to see the effect.

 So I tried entity encoding the question mark as #60;

That can't help, since #60; means exactly the same as ?. It is 
converted during the lexical processing of HTML markup, so the 
notational difference cannot have an effect on rendering.

 I also tried { white-space: nowrap; } on the td CSS rule, but that
 didn't do it either...again this is only IE7.

This is where things get really interesting. In a later note you added:
Adding it to both rules worked
And in fact, it has the desired effect when placed in the second rule,
td.pan  *:first-child { ... }. You probably first tried it in the first 
one, then added to the second, and didn't check what happens when you 
put it in the second one _only_.

It seems that you have encountered a serious bug in IE 7. By CSS 
specifications, the white-space property is inherited, so the a 
element should inherit it from its parent, td, since no style sheet 
assigns a white-space value for the a element. This seems to be a 
general bug in IE 7. If, for example, we have
spanfoo izip zap/i bar/span
and we assign white-space: nowrap to the span, then the effect should 
extend to the inner element's content zip zap as well. However, IE 7 
breaks between zip and zap when it sees that fit. Even if we think 
that suppresses line breaks within text does not mean _all_ text in 
the content of the element but just directly contained text, inheritance 
rules say that inner elements inherit the value.

However, we could still characterize the IE 7 behavior as feature, not 
bug, if we (rather articially) describe it so that the browser style 
sheet contains the rule
* { white-space: normal; }
This is different from the fact that normal is the initial value. Such a 
hypothetical browser style sheet prevents any inheritance for the 
white-space property.

This bug has serious implications for any use of white-space: you need 
to set it for inner elements as well. I guess it generally suffices to 
replace
foo { white-space: nowrap; }
by
foo, foo * { white-space: nowrap; }
for any selector foo.

It appears that IE 7 implements td nowrap in a manner that does not 
quite correspond to a white-space: nowrap declaration for the cell 
element, as we might expect. It affects whitespace handling but not e.g. 
line breaks after ?. The nonstandard nobr.../nobr markup is more 
effective.

Thus, using the CSS white-space property is the simplest way _provided_ 
that you take a precaution against the lack of inheritance on IE 7.

Jukka K. Korpela (Yucca)
http://www.cs.tut.fi/~jkorpela/ 

__
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/


[css-d] IE7 wraping URLs at the ? part...

2007-12-27 Thread Anthony Ettinger
It works everywhere else (FF, Opera, Safari), but IE7 seems to not
like the ? in a url, and wraps it within a table cell.

Markup is a cell in a table like this:

td class=pana href=foo.com?long_url=herefoo.com?long_url=here/a/td

CSS is:

td.pan { overflow: hidden; width: 12em; }
td.pan  *:first-child { display: block; overflow: hidden; width: 12em; }

So when the URL is extremely long, it wraps at the ? in the
query_string. I tried replacing with something else x and it no
longer wraps. So I tried entity encoding the question mark as #60;
but it still wrapped instead of hiding the portion of the URL past
12ems.

I also tried { white-space: nowrap; } on the td CSS rule, but that
didn't do it either...again this is only IE7.

-- 
Anthony Ettinger
408-656-2473
http://anthony.ettinger.name

@pets = Pets.find_all_by_species('dog')
@pets.each do |dog| {
if dog.name == 'Farley'
dog.nick = 'Sir Barks-A-lot'
elsif dog.name == 'Bonita'
dog.nick = 'Princess Boo'
else
dog.nick = 'Doggie?'
end
}
__
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/


Re: [css-d] IE7 wraping URLs at the ? part...

2007-12-27 Thread Anthony Ettinger
On Dec 27, 2007 1:40 PM, Anthony Ettinger [EMAIL PROTECTED] wrote:

 I also tried { white-space: nowrap; } on the td CSS rule, but that
 didn't do it either...again this is only IE7.

Adding it to both rules worked :)


-- 
Anthony Ettinger
408-656-2473
http://anthony.ettinger.name

@pets = Pets.find_all_by_species('dog')
@pets.each do |dog| {
if dog.name == 'Farley'
dog.nick = 'Sir Barks-A-lot'
elsif dog.name == 'Bonita'
dog.nick = 'Princess Boo'
else
dog.nick = 'Doggie?'
end
}
__
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/