>>document.documentElementとdocument.bodyの論理和は何故でしょう?

>   var b = document.documentElement ? document.documentElement : document.body;
> でもそりゃ長いし同じことだから
>   var b = document.documentElement || document.body;
> と書くようにしてます。

私も同じ疑問を抱いたので、調べてみました。

Netscape DevEdgeのJavaScipt Central
 ( http://devedge.netscape.com/central/javascript/ )
にある、JavaScript 1.3 Client-Side Reference のLogical Operators
のセクションには、
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/ops.html#1044813
> ||
> expr1 || expr2
> (Logical OR) Returns expr1 if it can be converted to true;
> otherwise, returns expr2. Thus, when used with Boolean values,
> || returns true if either operand is true; if both are false,
> returns false.
と書いてありました。(&& も同様。JavaScript 1.4,1.5も同じ)

ただし、「Backward Compatibility」として、
> JavaScript 1.0 and 1.1.
> The && and || operators behave as follows:
> ||
> If the first operand (expr1) can be converted to true,
> the || operator returns true rather than the value of expr1.
記述がありました。
1.2以前のReferenceは無かったので正確なところは不明ですが、
おそらく、JavaScript 1.2で仕様が変更されたのでしょう。

Logical Operaterは必ずBooleanを返す系統の言語育ちで、
JavaScriptはNetscape2.2の頃のJavaScript 1.1ベースの知識だったので
ちょっと驚きました。
でも、便利ですね。

和田