From: Garrett Smith on
Hans-Georg Michna wrote:
> On Mon, 05 Apr 2010 02:57:16 -0400, David Mark wrote:
>
[...]

>
> Any idea why Opera doesn't like innerHTML here? Is it the
> out-of-DOM div, the span in the div, or the \r that it does not
> like? I don't have Opera installed.
>

Opera 6. Do you care?

> This almost looks as if you should write innerHTML again from
> scratch for your library. It seems that innerHTML is rather
> fickle in some browsers. This reminds me of the severe
> restrictions it has in Internet Explorer. Bad!
>
> This is a pity. innerHTML can often replace several lines of
> code with just a short piece of HTML, which is also easier to
> read. I wish it would work universally without exception.
>

IE's problems with innerHTML are misfortunate. HTML 5 standardizes
innerHTML with well defined behavior that differs from IE.
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: David Mark on
Garrett Smith wrote:
> Hans-Georg Michna wrote:
>> On Mon, 05 Apr 2010 02:57:16 -0400, David Mark wrote:
>>
> [...]
>
>>
>> Any idea why Opera doesn't like innerHTML here? Is it the
>> out-of-DOM div, the span in the div, or the \r that it does not
>> like? I don't have Opera installed.
>>
>
> Opera 6. Do you care?

You sound like a jQuery developer. The point is that there is a gaping
hole in your logic. The older Opera just exposed it. You can "not
care" about that browser all you want, but it won't make the hole go away.
From: David Mark on
Hans-Georg Michna wrote:
> On Mon, 05 Apr 2010 02:57:16 -0400, David Mark wrote:
>
>> BTW, your test threw an exception at line 2 (before jQuery was even
>> involved) in Opera 6.
>
> Oops? The lines in question were:
>
>>> var x = document.createElement("div");
>>> x.innerHTML = "<span class='foo\rbar baz'>hey</span>";
>
> Any idea why Opera doesn't like innerHTML here? Is it the
> out-of-DOM div, the span in the div, or the \r that it does not
> like? I don't have Opera installed.

It has nothing to do with innerHTML. As I've advocated for some time,
you should never use the result of createElement without testing it
(it's null here in Opera 6). And, of course, you don't need
createElement to test the problem anyway.

>
> This almost looks as if you should write innerHTML again from
> scratch for your library.

As for get operations, I did. :) Not for sets though.

> It seems that innerHTML is rather
> fickle in some browsers. This reminds me of the severe
> restrictions it has in Internet Explorer. Bad!

My Library handles them just fine. They are feature tested and worked
around behind the scenes. Enjoy! :)
From: David Mark on
Garrett Smith wrote:
> David Mark wrote:
>> Garrett Smith wrote:
>>> Hans-Georg Michna wrote:
>>>> On Mon, 05 Apr 2010 02:57:16 -0400, David Mark wrote:
>>>>
>>> [...]
>>>
>>>> Any idea why Opera doesn't like innerHTML here? Is it the
>>>> out-of-DOM div, the span in the div, or the \r that it does not
>>>> like? I don't have Opera installed.
>>>>
>>> Opera 6. Do you care?
>>
>> You sound like a jQuery developer. The point is that there is a gaping
>> hole in your logic.
>
> The HTML class attribute multiple class names, separated by white space
> (set W), which HTML 4.01 defines. That attribute is exposed to
> javascript as `className`.
>

The logic in your _code_, professor.
From: Andrew Poulos on
On 6/04/2010 12:10 PM, Garrett Smith wrote:
> I love logic, BTW. I remember the first day of logic class when the
> teacher wrote:
>
> 1) if it rains, the grass will be wet
> 2) the grass is wet
> Therefore, it rained.

Someone may have watered the grass using a watering can.
A nearby river may broken its banks.
The grass may have been covered with cling wrap and the wetness you're
witnessing on the grass is from the grass itself...
It may have been a cold night and the wetness is dew that had formed.

Andrew Poulos