Ah, Thanks Thomas. Unfortunately, what I'm trying to detect is specific to a particular browser version (existence of the HTML5 File API, which at the moment is Firefox 3.6 only), I thought deferred binding was the right solution (everything else gets a Gears implementation) - but I'm not so sure (perhaps it's better to have a single Class that switches between the two implementations?).
I had a similar problem with the HTML5 drag and drop - Firefox 3.0 had a non-standard implementation... What do you think is more appropriate, deferred binding or bunging it all in one implementation? Cheers, Dave On Jan 25, 5:34 pm, Thomas Broyer <[email protected]> wrote: > On Jan 25, 3:12 pm, DaveC <[email protected]> wrote: > > > I'm using deferred binding to separate out some browser specific code. > > > In my *.gwt.xml file I've got a property provider (with a bit of > > Javascript doing some detection) and a replace-with/when... etc, > > > The deferred binfing works correctly and different browsers are > > getting different implementations. > > > But when I compile the project, instead of the usual 6 versions (one > > each for ie6,ie8,gecko,gecko1_8,safari and opera), it compiles 12 - if > > I add another deferred binding (replace-with/when) it says it's > > compiling 24!! > > > Is this correct behaviour? Or have I done something wrong? > > Each new property will add a new axis of permutations, so if it can > take 2 values it'll double the number of permutations. > This is the same behavior than when you add i18n, you'll have 6 > (user.agent) times the number of languages your app is translated in > (locale, that you'd have extended with <extend-property>). > > If you're dealing with browser-specific code, then you'd rather use > the existing user.agent property when possible. > > For instance, I developed a JSON module at work using native > JSON.parse/stringify when available and resorting to eval() and > JSONObject.toString() otherwise. I didn't introduce a new property but > based my code only on the user.agent property. We know that ie6, opera > and gecko don't support it, so they'll use the "emulated" > implementation, while ie8 certainly does so it'll use the "native" > impl. And for gecko1_8 and safari, I'm using a "fallback" impl that > tests for native JSON before instantiating one of the "emulated" or > "native" implementations and delegate to them. Given that they both > have a pretty fast JS engine, having all implementations code compiled > in isn't really an issue. > > GWT does the same in some cases where it needs to differentiate > between Safari 2 and 3+, (it used to do it in HistoryImpl at least) or > IE 6 and 7 (clipped image) -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
