Okay, I get what you're saying. But I don't understand why you think jQuery needs to modify its code significantly.
Right now, as per John, jQuery does: if supports_standards: use_standards else: use alt_method The only change that needs to happen to support your point is to replace the default else with a more explicit else if, and repeat ad infinitum until all alternate methods are exhausted. It's not all that big a change or shift in code. However, unless I'm misunderstanding your point, in terms of the end result, your approach is mostly equivalent to the current approach. In both cases, if none of the alternate methods work and the standard method doesn't work, things break. In your case, it breaks because none of the conditionals match. In the current case, it breaks because the alternate method doesn't work. On Thu, Jan 15, 2009 at 12:34 AM, Matt <m...@thekrusefamily.com> wrote: > > 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 > > > > -- --- David Zhou da...@nodnod.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---