Announcing a new online book: Eloquent JavaScipt

D

David Mark

I definitely don't think you want to play around with the window's scrollbars.

It *seems* to work fine now. Sure, I have to use some kind of hack to
make links to anchors work, and I wouldn't be surprised if there are
still some problematic corner cases on some browsers, but this really
seems preferable to the alternatives.
[html snippet]

That works very well for Firefox, but my obscure-css knowledge turned
out to be insufficient to make it behave properly on IE.

Add doctypes to your pages! Quirks mode is the problem. And the CSS
expression to simulate max-width in IE6 is simple. Google for it or
ask in a CSS group.

Besides,
fixing the width of these things will give long lines a scroll-bar
even when the client has a window that is wide enough to show them. I

Fixing the widths of what things? The code DIV's? The opposite is
true in that case. With my layout, wide code examples will scroll.
With your current layout, they hang off the right edge of the content
and cause horizontal scrollbars. Not to mention that they overflow
their borders.
tweaked things a bit more (slightly smaller font, narrower margins,

Leave the font size alone. Set it to 100% and design your layout from
there. And when testing, try different variations using View | Text
Size.
cut down a few more long lines), and now everything displays propertly
on 800x600. People using smaller windows than that are probably used

You are clearly only testing with one font size.
to horizontal scrolling ;)

It isn't just the scrolling, but the wasted space. Try enlarging your
browser's font size and scroll to the right to see what I mean.
I know. The console is entirely layed out by scripts and absolute
positions (texareas and iframes don't resize very well on their own),
and it was a major headache.

At least with the console is script-only to begin with.
 
D

David Mark

David said:
On Aug 3, 2:17 am, (e-mail address removed) wrote:
[...] You'll still need to implement a CSS expression to
simulate max-width in IE6 and earlier (wrap it in an IE conditional
comment.) You can put the text-align:center rule for the body in
there too (it is an old IE fix too.)
Oops. You are using quirks mode,

That is called Compatibility Mode in MSHTML.

Thanks for that. It is also known as and often referred to as quirks
mode.
Nonsense. IE < 7 does not support max-width, or min-width, max-height

I never said it did. If you would have read the thread before
posting, you would have seen that I explained how to simulate this in
IE6.

For example, here is a rule that simulates min-width for a page in
standards mode.

body {width:expression(document.documentElement.clientWidth <
550?"550px":"auto" )}

In quirks mode it would look like:

body {width:expression(document.body.clientWidth <
550?"550px":"auto" )}

It shouldn't be too hard to figure out how to apply a similar rule to
simulate max-width for the paragraphs in the book layout.

Please try to look before you leap.
 
D

David Mark

I tried standards mode, but it seemed to open a whole new can of IE
bugs related to the div-as-scrolling-document trick. It would

Actually, it has shown light on existing problems. You have tuned
your layout for IE's quirks mode. Other than Firefox, what other
browsers have you tested with?

insist
on showing the body scrollbars, and weirdly underestimate the size of
the div's content, making the scale of its scrollbar way too low, so
that you could only scroll half a page at a time (which would cause
the scrollbar to grow slightly bigger). Bizarre, huh?

I have no idea as I haven't looked into your CSS, but I suspect that
it has nothing to do with IE bugs.
 
D

David Mark

David said:
On Aug 3, 2:17 am, (e-mail address removed) wrote:
[...] You'll still need to implement a CSS expression to
simulate max-width in IE6 and earlier (wrap it in an IE conditional
comment.) You can put the text-align:center rule for the body in
there too (it is an old IE fix too.)
Oops. You are using quirks mode,

That is called Compatibility Mode in MSHTML.
so you will need to simulate max-width for IE period.

Nonsense. IE < 7 does not support max-width, or min-width, max-height
or min-height for that matter. In no rendering mode. Period.

And for that matter, you didn't even need to read the thread. Just
read what you quoted.
 
T

Thomas 'PointedEars' Lahn

David said:
David said:
On Aug 3, 2:17 am, (e-mail address removed) wrote:
[...] You'll still need to implement a CSS expression to ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simulate max-width in IE6 and earlier (wrap it in an IE conditional ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
comment.) You can put the text-align:center rule for the body in ^^^^^^^^
there too (it is an old IE fix too.)
Oops. You are using quirks mode,
^^^^^^^^^^^^^^^^^^^^^^^^^
That is called Compatibility Mode in MSHTML.

Thanks for that. It is also known as and often referred to as quirks
mode.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nonsense. IE < 7 does not support max-width, or min-width, max-height

I never said it did. If you would have read the thread before
posting, you would have seen that I explained how to simulate this in
IE6.

It is you who is not reading what he is replying to, or thinking of
replying to a posting of (sub)thread A in (sub)thread B and subsequently
doing so. How typical that you are blaming your readers for not
automatically unravelling the misunderstandings you caused.


PointedEars
 
M

marijnh

Actually, it has shown light on existing problems. You have tuned
your layout for IE's quirks mode. Other than Firefox, what other
browsers have you tested with?

Current Opera, Safari, IE6 and IE7. The scrollbar in standards-mode is
so screwed up that the only explanation is a bug. So no, I didn't
adjust my layout to quirks mode.

Marijn
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
glegroups.com>, Thu, 2 Aug 2007 07:12:56, (e-mail address removed) posted:
A freely-available online book about JavaScript has just been
launched:
http://eloquentjavascript.net

It attempts to provide a comprehensive introduction to the language,
and a practical environment for practicing your programming skills and
trying out code. Take a look, and let me know if you find anything
that could use improvement (there's a 'react' button in the top-left
corner of most of its pages).

Cheers,
Marijn Haverbeke

It seems to have improved overnight.

Your "last edited on 3/8/2007" will mislead Americans, and also anyone
who thinks you are more or less American (your name indicates only
ancestry). Use the ISO form, 2007-08-03; no reasonable person can
misunderstand that (some USG agencies might - Google YYYYDDMM).

Re another article : Code should never be machine-wrapped post-
authoring.

Re 52/53 : Due to the hidden leading "1" bit in an IEEE Double, of
course.

In Chap. 3, "at this looks" -> "as this looks" .

You should obfuscate your E-mail address in the source of the pages.
Change (e-mail address removed) to (e-mail address removed) - it will do no harm, and may do some good. I
also encoded part of the 'mailto:', but now I put my address only as an
image.
 
M

marijnh

Actually, it has shown light on existing problems. You have tuned
your layout for IE's quirks mode. Other than Firefox, what other
browsers have you tested with?

No, I haven't tuned my layout to IE's quirks mode. I have tested with
Safari 3, Opera 9, Firefox 1.5 and 2, and IE 6 and 7. The phenomenon I
was describing is sufficiently bizarre to make me feel justified to
assume it is a bug.

Cheers,
Marijn
 
M

marijnh

[sorry for the double post further back, I was being stupid]

Your "last edited on 3/8/2007" will mislead Americans, and also anyone
who thinks you are more or less American (your name indicates only
ancestry). Use the ISO form, 2007-08-03; no reasonable person can
misunderstand that (some USG agencies might - Google YYYYDDMM).

Hah, I should probably just make it "August 3rd 2007" or something,
and be done with it.
Re 52/53 : Due to the hidden leading "1" bit in an IEEE Double, of
course.

Thanks for clarifying this, I didn't get it from the cryptic remark
earlier. (I guess that particular aspect of IEEE floats had sunk
deeply into the swamp that is my brain.) -- Now how do I explain this
to new programmers going into long complicated tangents? Heh, I'll
think about it.
In Chap. 3, "at this looks" -> "as this looks" .

Thanks, fixed.
You should obfuscate your E-mail address in the source of the pages.
Change (e-mail address removed) to (e-mail address removed) - it will do no harm, and may do some good. I
also encoded part of the 'mailto:', but now I put my address only as an
image.

I've been painstackingly doing that for a while (or tricks with images
or javascript), but my address is all over the net already as it is,
and I guess spammers will have figured out this particular trick by
now.

Cheers,
Marijn
 
D

David Mark

David said:
David Mark wrote:
On Aug 3, 2:17 am, (e-mail address removed) wrote:
[...] You'll still need to implement a CSS expression to

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^>>>> simulate max-width in IE6 and earlier (wrap it in an IE conditional

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^>>>> comment.) You can put the text-align:center rule for the body in
^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^>> That is called Compatibility Mode in MSHTML.
Thanks for that. It is also known as and often referred to as quirks
mode.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I never said it did. If you would have read the thread before
posting, you would have seen that I explained how to simulate this in
IE6.

It is you who is not reading what he is replying to, or thinking of
replying to a posting of (sub)thread A in (sub)thread B and subsequently
doing so. How typical that you are blaming your readers for not

You are out of your mind. And what the hell is a (sub)thread A? This
very simple thread and the very simple issue you confused went
something like:

1. I told the OP they would have to simulate max-width in IE6.
2. I realized they were using quirks mode and amended that to IE
period as IE7 still won't do max-width in quirks mode.
3. You jumped in with an incorrect interpretation of (2) as apparently
you didn't understand what I meant.
4. I corrected you and told you (once again) to read (and comprehend)
before posting and you replied with this rubbish.
 
D

David Mark

Current Opera, Safari, IE6 and IE7. The scrollbar in standards-mode is
so screwed up that the only explanation is a bug. So no, I didn't

No. The explanation for that particular problem is this line of code:

document.body.style.overflow = "hidden";

In standards mode it is the documentElement that has the scrollbars.
adjust my layout to quirks mode.

The layout and the script were clearly written for quirks mode.
That's why you have to make adjustments when switching to standards
mode.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
glegroups.com>, Fri, 3 Aug 2007 02:05:58, Peter Michaux
You may wish to learn about using CSS, the cascade, !important rules
and reader stylesheets. You may also find that some browser plugins
make using this technology more accessible to you.

https://addons.mozilla.org/en-US/firefox/addon/2108

No. I want to have my browser as-delivered, just like the ones in the
Library are; not to need to change my general preferences; and not to
make special provision for reading particular sites. My vision is near
enough normal.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
legroups.com>, Fri, 3 Aug 2007 06:09:14, (e-mail address removed) posted:
On 3 aug, 00:42, Dr J R Stockton <[email protected]> wrote:
Good point about the date and author, I guess I'll add these to every
page. Could you tell me which browser you use and which errors the
feedback system gives you?

IE6 in XP sp2; but the errors have gone. The main box is still too
small; the address box is too short for the address I would put there;
the name box is too short for at least one of my friends, and the
Subject box is too short.
Which are?

Should you be writing a Javascript text if you know so little? The ISO
standard gets it right.

I didn't know >> and << are 32 bit. (That is a shame.) Does unary + do
anything that the Number function doesn't? -- Apart from being
shorter.

As above.

It's quicker, too. Maybe Number has to create an Object, while + does
not have to. They can, for example, both take Boolean arguments.



I have a response to DM in hand, but the window has crashed. The draft
may reappear on reboot, tomorrow.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
 
A

Animesh K

[sorry for the double post further back, I was being stupid]

Your "last edited on 3/8/2007" will mislead Americans, and also anyone
who thinks you are more or less American (your name indicates only
ancestry). Use the ISO form, 2007-08-03; no reasonable person can
misunderstand that (some USG agencies might - Google YYYYDDMM).

Hah, I should probably just make it "August 3rd 2007" or something,
and be done with it.

03 Aug 2007 (don't need comma etc. This one is advocated by Strunk and
White in Elements of Style.
 
M

marijnh

IE6 in XP sp2; but the errors have gone. The main box is still too
small; the address box is too short for the address I would put there;
the name box is too short for at least one of my friends, and the
Subject box is too short.

Yes, but fortunately these text fields (marvellous things that they
are) allow one to input text that is wider than the fields themselves.
Also, there's an e-mail link at the bottom of each page now, for those
who'd rather use their own mail client.
Should you be writing a Javascript text if you know so little? The ISO
standard gets it right.

Ugh. Either you tell me what you are talking about, or I shall
regrettably be forced to classify you as a useless buffoon.
It's quicker, too. Maybe Number has to create an Object, while + does
not have to. They can, for example, both take Boolean arguments.

Number does not create an object, unless 'new' is applied to it. Thus,
it seems to be equivalent to unary-+, more verbose, but also clearer.

Regards,
Marijn
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
glegroups.com>, Thu, 2 Aug 2007 17:15:54, David Mark
Are you suggesting that pages should not suggest a font family for
their main content?

For informative material, such as might be printed similarly in a book
or a quality newspaper, yes, I am. The author cannot know the
properties of the reader's screen, eyeballs, or brain.
Or to stick with generics only? I can't see
leaving it to the user as most would see a default of Times New
Roman.

If it's good enough for The Times, it's good enough for the Net. It's a
very readable font. If Times New Roman in default size is not
acceptable to the user, then they can change it.

I have always thought that serif fonts read easier on paper and sans-
serif is more legible on monitor screens. Obviously you can't please
everybody in this regard.

That is commonly said, and has long been said. I suspect it dates from
the era when the VT100 was new, and fonts were fixed-pitch and only a
few pixels wide. The situation with GUI text on a modern screen is very
different.

The author cannot know the reader's screen size and quality, or the
state of the reader's eyesight.


I don't much mind some sans-serif fonts, Arial for example; I don't know
what font Marijn is calling for - actually, what I see is much better
Zoomed one step, apart from then being too big. What I see is like the
font in the interstitials in Brin's Jijo books, UK pbk.; it is not my
default sans-serif font.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
oglegroups.com>, Fri, 3 Aug 2007 13:07:07, David Mark
On Aug 3, 7:20 am, Thomas 'PointedEars' Lahn <[email protected]>
wrote:

You are out of your mind.

You are fairly new here. What you observe was thoroughly established
here last year, as can be established no doubt through Google.

TL reminds me of the joke about the BAOR carollers that got put on a
fizzer one Xmas.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
oglegroups.com>, Fri, 3 Aug 2007 18:59:05, (e-mail address removed) posted:
Thanks for clarifying this, I didn't get it from the cryptic remark
earlier. (I guess that particular aspect of IEEE floats had sunk
deeply into the swamp that is my brain.) -- Now how do I explain this
to new programmers going into long complicated tangents? Heh, I'll
think about it.

You don't.

You just say that a JS Number can hold every integer within
+-9007199254740992 (inclusive) exactly; and can hold with an accuracy of
better than 1 in 10^15 any value of magnitude between 10^-308 and
10^+308, also +-Infinity. And that logical operations on Numbers are
32-bit. Check the ISO/IEC or ECMA standard for details.

Then you cite a reference for the structure of an IEEE Double.


I think that you should add, maybe as an Appendix, a few major
references - the ISO standard, this group, its FAQ, and something like
<http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide>.


It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
 
R

Richard Cornford

On 4 aug, 00:35, Dr J R Stockton wrote:

Number does not create an object, unless 'new' is applied
to it. Thus, it seems to be equivalent to unary-+, more
verbose, but also clearer.

There is object creation implied in all calls to native function objects
(the - arguments - object at minimum, probably the Activation/Variable
object (as the Variable object needs to be unique if closures are used),
probably an object for the execution context's scope and possibly an
object for the execution context itself). None of that is necessarily
true for the built-in functions, but still testing suggests that -
Number(x) - is 4 to 7 times slower than - (+x) - and as the outcome is
specified to be identical the difference is most likely accounted for in
the overheads of the function call.

Richard.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
legroups.com>, Sat, 4 Aug 2007 05:56:54, (e-mail address removed) posted:
Yes, but fortunately these text fields (marvellous things that they
are) allow one to input text that is wider than the fields themselves.

Of course. But it is nice to be able to see the whole entry at once.
BTW, I'd particularly suggest serif or monospace there - if one happens
to enter a name with the letter "ij" in it, it's difficult to see in
sans-serif whether one has got it right.
Also, there's an e-mail link at the bottom of each page now, for those
who'd rather use their own mail client.

Appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,414
Latest member
GayleWedel

Latest Threads

Top