On Jan 14, 10:52 pm, "David Zhou" <da...@nodnod.net> wrote:
> Can you elaborate on these concepts?

Simple. Don't make the assumption that if the standard approach
doesn't work, then a specific fix will. That's almost as bad as saying
"if the user agent string says X, then method Y must be available."

If the standard approach fails, you must first test to see if the
possible fix is available and will correct things before branching to
that code. Don't make the assumption that it's the only possible fix
and apply it blindly.

What is being done now is called "feature inference" rather than
"feature detection". The code doesn't detect that "alpha" is needed to
fix an "opacity" bug, it just assumes it because "opacity" (et al)
doesn't seem to work and "alpha" is the only known fix in a small
subset of browsers that jQuery chooses to support. This is not feature
detection.

If you don't like the looks of testing for fixes before defaulting
back to standards behavior, you could use logic like:

use_standards = true
if (!standards_test)
  use_standards = false
  if (fix1_test)
    use_fix1 = true
  endif
endif

Then you have a real picture of what the browser supports. Then in the
code you can simply do

if (use_standards)
  do_standard_way
else if (use_fix1)
  do_fix1_way
else
  blow up or do nothing or return false or something

If a buggy browser is improved to support the standard method, it will
always be used.
If a browser doesn't support standards but supports an alternate, it
will be used.
If neither are supported, an incorrect fix is NOT applied and assumed
to work, and the code can either blow up and say the browser is
unsupported or give the calling code some way to correct itself for
missing browser functionality.

Matt Kruse

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to