This discussion probably belongs on the dev list, but... The problem with solving this via DOM manipulation is that DOM manipulation is a hacky thing that is inherently hard to maintain. Most of the Tapestry components currently emit their HTML from the Java class, even though we all know that combining markup and code is a bad practice in principle. Adding DOM manipulation to Java-emitted HTML is just making the maintainability issue worse, it seems to me.
Tapestry components *could* use templates instead, and the bootstrap-version-specific changes we're talking about are mainly just bits of scattered HTML (adding wrapper DIVs with certain CSS classes named, for example), so the natural place for it is in HTML files, which in Tapestry means TML files. Tapestry already has a mechanism for having multiple templates per component. It's used for having language-specific templates, and for the mostly undocumented template skinning. Now, in the case of bootstrap versions, the first fear would be that the tml files would multiply like crazy and we'd have a different sort of maintenance problem with hundreds of template files to keep track of. Actually, no, I don't think that's the case, because we would only have to introduce a new template if a specific version of Bootstrap requires different HTML for *that* component. You don't need a separate TextField.tml template for Bootstrap 2, 3 and 4 unless the <input type="text"> tag needs to have different HTML rendered for each of those Bootstrap versions. Secondly, these templates would mostly be very small little things. For example, the TextField default template (TextField.tml) might be just this one line: <input type="${type}" name="${controlName}" id="${clientId}" value="${value}" size="${width}" /> and the TextField Bootstrap 3 template (bootstrap3/TextField.tml) would be: <input type="${type}" name="${controlName}" class="form-control" id="${clientId}" value="${value}" size="${width}" /> The only difference there is the class="form-control" part. On Fri, Dec 12, 2014 at 8:30 AM, Dmitry Gusev <dmitry.gu...@gmail.com> wrote: > Correct me if I'm wrong, but 5.4 doesn't provide default CSS. It uses > hardcoded bootstrap HTML/CSS instead. > > It could produce default HTML (or even XML) without CSS at all and provide > default bootstrap module that converts this markup to bootstrap - voila - > you have default CSS, but also a more or less stable API for 3rd party CSS > frameworks. > > I'm sure you know that adopting modern CSS framework is not that simple as > updating CSS rules, it also includes DOM rewrite. > > And as far as I know 5.4 isn't backward compatible here, so overriding CSS > and rewriting DOM in a T5.3 app won't help during upgrade. > > You mentioned component replacement, but that's not an option too. Try to > replace the t:Form component and form fields - that's not a trivial task. > > So that's a real issue to our app. > > > On Fri, Dec 12, 2014 at 3:48 PM, Thiago H de Paula Figueiredo < > thiag...@gmail.com> wrote: >> >> On Fri, 12 Dec 2014 05:24:33 -0200, Dmitry Gusev <dmitry.gu...@gmail.com> >> wrote: >> >>> So I highly support Barry's suggestions on no framework specific html and >>> css. >>> >> >> Easier said than done. If Tapestry provides no default CSS, new >> applications will look very badly. Anyway, you can easily override any CSS >> provided by Tapestry plus CSS classes can be easily overriden through CSS >> alone, not to mention what you can do with DOM rewriting and component >> replacement (5.4), so I don't think this should be an issue at all for >> upgrading to 5.4. >> >> -- >> Thiago H. de Paula Figueiredo >> Tapestry, Java and Hibernate consultant and developer >> http://machina.com.br >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > -- > Dmitry Gusev > > AnjLab Team > http://anjlab.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org