Singleton desing patter approach without function expressions...

  • Thread starter Luke Matuszewski
  • Start date
R

Richard Cornford

VK said:
Thomas 'PointedEars' Lahn wrote:

So we have either close this newsgroup as futile: because
there is no way to detect the presence and *workability*
of some feature.

The majority of the regular contributors to this group have been coping
with the way web browser object models are for half a decade or more.
You might throw up your hands in horror at discovering that there is
more to the practice than you can conceive of but that is not a surprise
to anyone else.
As it seems like not an option :) then we have to find
more or less reliable way to check the platform and feature
with possible small percent of browsers we have to screw on.

Try to remember that your mental process has you choosing the worst
possible approach to any issue, and you are doing it again here. Don't
speak of "we" when you are describing your personal shortcomings.

Richard.
 
T

Thomas 'PointedEars' Lahn

VK said:
I know this site, thank you though.

I repeat my question:

what does
compatMode == "BackCompat"
and
compatMode == "CSS1Compat"

means in application to Gecko?

If the Gecko-based UA renders the document in Standards Compliance Mode, the
value of the `compatMode' property is "CSS1Compat". Otherwise, if it is
rendered in Quirks Mode, the value is "BackCompat".
Can I switch Firefox in "IE-compatible" mode?

Whatever that might be, no. DOCTYPE switching is triggered by the DOCTYPE
declaration or by omitting it.
Or it's just an attempt to mimic IE even if it can break someone's old
code?

Neither one. This property works the same in IE, only that Quirks Mode is
called Compatibility Mode there.
I stay on the second one.
Figures.


In direct relevance as you can see now.

Richard argued that document.compatMode cannot be used to detect IE.
Your rant had no relevance to that. Again.
So we have either close this newsgroup as futile: because there is
no way to detect the presence and *workability* of some feature.

Nonsense, there is.


PointedEars
 
V

VK

Thomas said:
If the Gecko-based UA renders the document in Standards Compliance Mode, the
value of the `compatMode' property is "CSS1Compat". Otherwise, if it is
rendered in Quirks Mode, the value is "BackCompat".

If IE says "BackCompat" it means that it uses Internet Explorer Box
Model which has a significant difference from W3C Box Model. It also
renders style declarations and some attributes differently (in IE's
way). The full list of differences one can find at
<http://msdn.microsoft.com/library/en-us/dnie60/html/cssenhancements.asp>

If it says "CSS1Compat" than it goes by W3C specs (at the best of its
abilities).

That was the main and only purpose to introduce this property, so
developers could make a runtime check.

If some browser later decides to introduce this property (with the same
values!) than I expect that it will indicate to the same differences as
spelled at
<http://msdn.microsoft.com/library/en-us/dnie60/html/cssenhancements.asp>

If not (and it is not) then it's a nasty useless crap that breaks my
pre-existing code.

Firefox declares "CSS1Compat" for any DTD as long as it's presented. So
the only use I see of it (Thomas' special :) is:

if ('BackCompat' == document.compatMode) {
var url = 'http://validator.w3.org/check?uri=';
url+= escapeURIComponent(window.location.href);
alert('DTD is missing!');
window.location.href = url;
}

Don't see any serious usage for it neither for Gecko nor for Opera. Am
I so blind? Possibly.
This property works the same in IE, only that Quirks Mode is
called Compatibility Mode there.

Again, the full detailed explanation of how it works in IE explained
here:
Richard argued that document.compatMode cannot be used to detect IE.
Your rant had no relevance to that. Again.

So let us think what would be the way to detect that it's IE and it's
in CompatMode, so we could for example calculate offsets properly. I
practically need it and now I'm really running out of fantasy what's
not covered yet by the mimicrie?

P.S. This thread is going to be the Queen of Off-Topics I'm affraid.
 
T

Thomas 'PointedEars' Lahn

VK said:
If IE says "BackCompat" it means that it uses Internet Explorer Box
Model which has a significant difference from W3C Box Model.

OK, I know of no equivalent for that in Gecko-based UAs.
It also renders style declarations and some attributes differently [...]

That is the same in Quirks Mode in Gecko-based UAs. The reason is that in
both UAs another base stylesheet is used.
[...]
That was the main and only purpose to introduce this property, so
developers could make a runtime check.

If some browser later decides to introduce this property (with the same
values!) than I expect that it will indicate to the same differences as
spelled at
<http://msdn.microsoft.com/library/en-us/dnie60/html/cssenhancements.asp>

The result of these "CSS enhancements" are invalid and/or not interoperable
stylesheet which is what forces Web developers to hide parts of their CSS
from broken IE and still have them working as supposed in compliant user
agents.
If not (and it is not) then it's a nasty useless crap that breaks my
pre-existing code.

To put in bluntly, the problem here is that your code is crap, as in the
following:
Firefox declares "CSS1Compat" for any DTD as long as it's presented. So
the only use I see of it (Thomas' special :) is:

if ('BackCompat' == document.compatMode) {
var url = 'http://validator.w3.org/check?uri=';
url+= escapeURIComponent(window.location.href);
alert('DTD is missing!');
window.location.href = url;
}
[...]
Richard argued that document.compatMode cannot be used to detect IE.
Your rant had no relevance to that. Again.

So let us think what would be the way to detect that it's IE [...]

There is exactly no need to detect that it is IE. The major flaw in your
logic is that you actually believe there is.


PointedEars
 
R

Richard Cornford

VK wrote:
If not (and it is not) then it's a nasty useless crap that
breaks my pre-existing code.

You write code that is chaotic, brittle and maintenance-heavy and then
test it sufficiently ineffectively that you can maintain the illusion
that you know what you are doing. The results are going to fall apart at
the slightest provocation, that is inevitable. But Gecko browsers have
had the - document.compatMode - property from Mozilla 1.0, and Opera
since the release of version 7, so its existence should hardly come as a
surprise after all these years.

So let us think what would be the way to detect that it's IE
and it's in CompatMode,

You should never need to do that. You should be identifying the question
that really needs to be answered, as the appropriate test will follow
from that.
so we could for example calculate offsets properly.

So the real question relates to the significance of the properties used
in calculating offsets.
I practically need it and now I'm really running out of
fantasy what's not covered yet by the mimicrie?

Well you could always ask a question on the group and see if any of the
people you have relentlessly disregarded and wasted the time of are now
willing to lift a finger to help you. (For all you may regard everyone
here as uninformed amateurs dabbling in browser scripting it is obvious
that most have worked out successful strategies for working with
offsets).
P.S. This thread is going to be the Queen of Off-Topics I'm
affraid.

The subject header of a thread is unrelated to what way or may not be
off topic for the group. We are still discussing scripting web browsers
with javascript, which is on topic.

Richard.
 
V

VK

Richard said:
You should never need to do that. You should be identifying the question
that really needs to be answered, as the appropriate test will follow
from that.

I need to have an expression evaluated to true

if (IE, IE only and nothing but IE) && (IE in CompatMode)

in order to implement the proper offset calculations. Any other
browsers do not change offset rules depending on mode so out of my
interest. Your suggestions?
 
R

Richard Cornford

VK said:
I need to have an expression evaluated to true

if (IE, IE only and nothing but IE) && (IE in CompatMode)

in order to implement the proper offset calculations. Any other
browsers do not change offset rules depending on mode so out of my
interest. Your suggestions?

Stop thinking in terms of browsers and identify the question you really
need to have answered. You want to know something about the meaning of
offset values so that is what the question you need answering relates
to.

Richard.
 
V

VK

Richard said:
Stop thinking in terms of browsers and identify the question you really
need to have answered. You want to know something about the meaning of
offset values so that is what the question you need answering relates
to.

Strange question. Nevertheless:

<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie60/html/cssenhancements.asp>

<quote>
Compliant Behavior

With Internet Explorer 6 or later, when you use the !DOCTYPE
declaration to switch on standards-compliant mode, the width and height
properties specify the distance between the left and right edges and
top and bottom edges of the bounding box, respectively. The border and
padding belts are not included.
Noncompliant Behavior

When the !DOCTYPE declaration does not switch on standards-compliant
mode, as with earlier versions of Internet Explorer, the width property
includes the object's content box, plus the values of the following
properties: border-left, border-right, padding-left, and padding-right.
Subtracting the sum of the values of these properties from the value of
the width property equals the width of the parent object's content box.
Likewise, subtracting the sum of the values of the border-top,
border-bottom, padding-top, and padding-bottom properties from the
value of the height property equals the height of the parent object's
content box.
</quote>

There is only one browser implementing IE's Box Model in quirk mode,
and overall only one known browser implementing a different box model
in quirk mode: this is IE.

So the minimum reqirement is:

Detect that this is IE
and
Detect that it's in quirk mode

Your solution?
 
M

Matt Kruse

VK said:
With Internet Explorer 6 or later, when you use the !DOCTYPE
declaration to switch on standards-compliant mode, the width and
height properties specify the distance between the left and right
edges and top and bottom edges of the bounding box, respectively.
...
So the minimum reqirement is:
Detect that this is IE
and
Detect that it's in quirk mode
Your solution?

What do you really want to know?
Meaning, what do you want to do in script that requires you to know which
box model IE is using?
 
V

VK

Matt said:
What do you really want to know?
Meaning, what do you want to do in script that requires you to know which
box model IE is using?

Never mind: I've got so upset and overall bitchy over the last week
that I've forgotten about IE pre-processor instructions (/*@cc_on*/)
That solves my problem in the no-fail way.

Overall it was about offsetHeight / offsetWidth for VML drawings (all
around my SVL+VML = SVL project)



Ceterum censeo Array jagged est :)
 
R

Richard Cornford

VK said:
Strange question.

Not really. It is a sort of test; are you capable of analysing a problem
to the point of identifying the real issue, and so seeing the question
you need answered or will you just fixate on browser detecting and write
another brittle, unreliable maintenance-heavy script.
Nevertheless:
<quote>
Compliant Behavior

... , the width and height properties specify the distance
between the left and right edges and top and bottom edges
of the bounding box, respectively. ...

Noncompliant Behavior

... , the width property includes the object's content box, plus
the values of the following properties: border-left, border-right,
padding-left, and padding-right. ...

In standards mode the CSS width/height does not include the borders and
padding, while in quirks mode it does. Since the offsetWidth/Height
properties of a block element state the dimensions of the block
including the borders and padding all you have to do is compare the
offsetWidth/Height of a suitable element with its specified CSS
width/height and if the offset values exceed the CSS values that the CSS
values are defining distances excluding borders and padding.

And that test will tell you no more, and no less, than the disposition
of the CSS width/height properties on every browser that exposes the
appropriate properties, past present and future, and without any
interest in or dependency upon the web browser in question.
There is only one browser implementing IE's Box Model
in quirk mode,

Given that you have a superficial familiarity with two or three web
browsers, in their default configurations, you are not the person to be
generalising about web browsers. As it happens IceBrowser 5 did a very
good job of reproducing the IE box model, it may not be alone in that.
and overall only one known browser

Known to you, don't forget that you don't know much really (and
sometimes less and less as time goes on).
implementing a different box model
in quirk mode: this is IE.
False!

So the minimum reqirement is:

Detect that this is IE
and
Detect that it's in quirk mode

Look at that, you posted the definition of the differences between
standards mode and quirks mode and didn't stop to read the words and see
that they effectively state the question you wanted answered.
Your solution?

Do more work on problem analysis and logic, you will find them
invaluable skills in programming.

Richard.
 
V

VK

W3C response for the proposal to update 4.01 Strict:
I'm afraid it's completely pointless to suggest changes to HTML 4.
It's frozen; all work on HTML specs is oriented towards XHTML and
specifically XHTML 2.0. Even reported simple _technical_ errors (in
the way things are presented, as opposite to the intended meaning) in
HTML 4 specs haven't been fixed. And probably won't.

As totally expected.

Lucky there are still people with a non-damaged perception of the
reality like <http://www.whatwg.org/>. Their HTML 5 and Form 2.0 are
exactly what I had in my mind. It is good to know that you are not a
nut, but someone triple-W'ed is... or at least that you are not the
only nut in the block :)
 
T

Thomas 'PointedEars' Lahn

VK said:
Thomas said:
VK said:
W3C response for the proposal to update 4.01 Strict: [...]
^^^^^^^^^^^^
Nonsense.

What exactly?

The response text? That it's from W3C functionnairs? (it is)

Not at all. It is a statement from a (respected) individual on a public
mailing list, as Google shows easily:

<URL:http://lists.w3.org/Archives/Public/www-html/2006Feb/0083.html>

Are you deliberately making a fool of yourself?

Or are you just trolling? You would have included the reference to the
mailing list archives if you were not.


PointedEars
 

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
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top