Post by VKPost by Peter MichauxPost by Richard Cornford<snip>
All I want from you is the definition of the "feature detection".
You either can give it or you have no idea what are you talking
about. I am not answering your questions until I see that.
Did Richard not write the following?
<URL:http://www.jibbering.com/faq/faq_notes/not_browser_detect.html>
That should pretty much explain it for you.
Peter
Are you being the herald of His Majesty? :-)
I have read the linked resource and in the particular of
"A Strategy That Works: Object/Feature Detecting."
http://www.jibbering.com/faq/faq_notes/not_browser_detect.html#bdFD
I am reminding that this whole branch of conversation,
intensively filled with personal insults - which is a
regular brand style of Mr.Cornford I have used to over
last years - all this branch started from Mr.Cornford's
claims that I have no idea what "feature detection" is
This branch of the thread did not start with my pointing out that you
clearly had no idea what "featured detection" is. It started with your
responding to my saying that:-
| feature detection is the only strategy that takes a reasoned/rational
| approach to the problem.
- with the statement "That is a false statement right here", followed by a
lot of your pontificating about why 'feature detection' was "promising
reliable strategy several years ago" with its reliability "mainly based on
the fact that nothing was changing from one year to another", and followed
by an example of code that, in context, looked like it was supposed to be
about feature detection, even though it was pretty clearly an 'object
inference' test (and an unreliable one at that).
I did ask you if you actually had intended that posted code to be an example
of 'feature detection', but the simple yes or no answer you could have given
has not yet appeared.
It is neither too difficult, nor at all unreasonable, to conclude that if
someone posts a mass of text that they assert to be about '"feature
detection" but is actually pure bullshit when applied to feature detection,
then that individual does not understand what feature detection is. It may
also be reasonable to ask questions to determine whether what that
individual appears to be saying is what they intended to be saying, but no
grater clarification results if those questions are never answered.
Post by VKand whatever I am doing is not the feature detection.
The code you posted was not feature detection, or even close to it.
Post by VKThe I gave my definition of feature detection
A definition that had no relationship with the code you had previously
posted as an apparent example of 'feature detection'.
Post by VKand I proposed to Mr.Cornford to provide his own to find
where my possible misunderstanding may reside.
The misunderstanding resides in your mind, as usual.
Post by VKMy definition - and I remind - was
<quote>
For my humble mind "the feature detection" is
the process of determining if the current environment
where the theoretical possibility of the presence of
entity X is known in advance at the moment of the
development.
</quote>
And it remains a waste of everyone's time. Not being able to do joined-up
logic yourself you will not be able to see how far that assertion falls
short of being something that can be usefully applied.
Post by VKOn the go of the next several posts Mr.Cornford failed
to provide any adequate definition of the topic of question.
But I did not fail to indicate where you should look in order to acquire an
understanding of the subject. You just decided not to bother looking.
Post by VKIf he thinks that a
strict definition of a technical term
It is not a strict definition of anything. The only stated relationship
between "entity X" and "task Y" is that implied by the word "so", which is
so vague as to be utterly useless.
Post by VKcan be anyhow compensated by personal insults and
by demonstration of personal writing skill in
English then it is sorry mistake, I have to say.
Now by looking the jibbering.com resource the closest
It is not a definition, it is an introductory description.
Post by VK<quote>
Feature detecting seeks to match an attempt to execute as
script (or a part of a script) with the execution
environment by seeking to test features of that environment
where the results of the test have a direct one-to-one
relationship with the features that need to be supported
in the environment for the code to successfully execute. It
is the direct one-to-one relationship in the implemented
tests that avoids the need to identify the specific browser
because whatever browser it is it either will support all
of the required features or it will not. That would mean
testing the feature itself (to ensure that it exists on
the browser) and possibly aspects of the behaviour of that
feature.
</quote>
It is not a definition, it is an introductory description.
Post by VKyet by squeezing out all unnecessary wording it is exactly
the same of what I initially said.
At minimum that statement makes very strong assertions about the
relationship between the subjects of the tests and the reasons for the
tests. You likely do see that as "unnecessary wording", but only because the
concept has gone far over your head.
Post by VKIf anyone thinks that not then please correct me.
To what end? You never pay any attention to corrections you are given.
Post by VKNB: "and possibly aspects of the behaviour of that feature"
at the end of the definition is a bogus to skip, of course.
So you did not see how it is both possible to test the actual behaviour of
the environment and why doing so may be necessary from the examples given? I
cannot say that surprises me.
Post by VKIt is not nice of Mr.Cornford to try to protect the
definition by making it so ridiculously ambivalent.
It is not a definition, but it would have not been a satisfactory document
without at least one example of purely behaviour related testing.
Post by VKEither one does an abstract feature detection or one
tests the feature behavior across certain amount of UAs.
Either? And what do "UAs" have to do with anything?
Post by VKEither we are making a feature detection or we are
making browser sniffing.
Yes, browser sniffing is not feature detection, in the same way as object
inference is not feature detection.
Post by VKEither possible,
Browser sniffing and feature detection? Being possible is not the issue, but
rather their relative effectiveness and possible claims to be a
reasoned/rational approach to the problems of browser scripting.
Post by VKbut let's do not define the feature detection as the
browser sniffing, or vice versa, or all together in one
pack, OK?
You have started gibbering again.
When you say "sample" and "provided" do you mean the code you posted, or
your proposed, but never coded, application of your "definition"?
Post by VKin order to accomplish a particular task I need
window.netscape.security.privilegeManager object
to use its enablePrivilege method.
And as I have already said; that a totally unrealistic example of a 'task'
because acquiring a privilege is never an end in itself. Any actual task
that is to be achieved will require at least one "entity X" in addition to
window.netscape.security.privilegeManager.enablePrivilege.
This exposed one of the logical holes in your "definition" because "task Y"
may require the window.netscape.security.privilegeManager.enablePrivilege to
exist, and so imply that it be tested for (so satisfying your "so"
relationship), but if the task also required
"Components.interfaces.nsILocalFile" you have nothing to imply that that
should also be the subject of testing. And that is quite important because
the whole justification for your testing for - window.opera - in your posted
example followed from your failure to do anything about verifying that the
environment did have - Components -, - Components.interfaces -,
Components.interfaces.nsILocalFile -, etc. Because if you had been testing
for the features that had a direct relationship with the "task Y" that you
intended to attempt you would not have found them on Opera browsers and so
would not have to worry about whether any browser on which you did not find
them was actually Opera or not.
And while you are fixating on the security.privilegeManager object you are
falling to notice that if you remove the - window.opera - test from your
code the exception thrown is:-
| Reference to undefined variable: Components
Which had nothing to do with any capabilities of the
security.privilegeManager object, but everything to do with trying to employ
an object in an environment where it doesn't exist. Just executing the -
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); -
line on Opera (at least 7.5 and 8.5) does not throw an exception.
Post by VKRespectively before to accomplish this task I am checking the
existence of "window", "window.netscape", "window.netscape.security"
and "window.netscape.security.privilegeManager".
But your posted 'example' clearly did not test for
window.netscape.security.privilegeManager, nor
window.netscape.security.privilegeManager.enablePrivilege.
Post by VKIt is possible that everything is here including
"enablePrivilege" method but at the same time it is
What is "spoofing bogus" supposed to mean?
Post by VKsuch environment is one of versions of Opera, so I
additionally check for (typeof window.opera != 'object').
Ah, so we are talking bout the code you posted, the code in which you never
did check for the existence of window.netscape.security.privilegeManager,
etc.
Post by VKNo feature detection can possibly help in this
On the contrary, feature detection would have entity solved you proposed
issue that necessitated testing for - window.opera - in the code you posted.
The task you were trying to perform was well beyond the task of acquiring a
privilege and necessitated that the environment provide the extensive set of
other objects employed by the code. Opera browsers do not provide those
objects so testing for them prior to entering the branch where they were
used would mean that no opera browser would enter that branch and so no
code that attempted to use those non existent objects would ever be
executed.
Post by VKand in N^n of similar situations.
For you situations, where your inability to analyse directly results in
issues that you cannot effectively cope with, that must be a daily
occurrence. but your personal limitations have no baring on anyone else.
Post by VKMy script works not out of some theoretical
considerations,
Your posted script didn't work. It was going to error-out on every browser
that had a - window.netscape.security - object and was not Opera, but also
did not provide any of the remaining features required by the branch of code
that was going to be executed as a result of the test. Your justification
for that was (and probably will remain) that you do not care about any of
those browsers. But not caring when something does not work is not the same
as having something that does work.
Post by VKhowever well reasoned they would be.
You don't reason, else you might have seen what when an exception says
"Reference to undefined variable: Components" it is much more reasonable to
test the environment for the existence of the - Components - than to infer
its non-existence from the presence of a - window.opera - object.
Post by VKMy script works because it was deployed on all environments I do
care about,
There you go, you do not care that what you are doing will error-out in
environments that you do not care about.
Post by VKtested and adjusted if needed. If it also works for some
other untested (currently non-interesting = non-payable to me)
environments then so the better. If not then screw them for now.
Strange as the idea may seem to you there are people who are interested in
doing the best job they can, rather than creating structures consisting of
aggregations of dubious hacks and then saying "screw then" when the
consequences emerge.
Richard.