Template talk:Clade#Browser differences - Chrome vs. Firefox

{{WikiProject banner shell|

{{WikiProject Tree of Life }}

}}

{{oldtfdfull|date= 2018 April 24 |merge = Template:Cladogram| result=do not merge |disc=Template:Clade and Template:Cladex}}

Documentation is at Template:Clade/doc. Please check Template:Clade/doc#Limitations before raising a problem here.

----

2007

I'm afraid this template is not ready for the big time, as it has a number of problems:

1.If a label is long, it wraps, thereby potentially breaking the connection of its line to its subclade. e.g.

{{clade

|label1=B. ser. Abietinae

|1={{clade

|1={{clade

|1=B. subser. Nutantes (2 taxa)

|2=B. subser. Longistyles (7 taxa)

}}

|2={{cladex

|1=B. subser. Sphaerocarpae (5 taxa)

|label2=B. subser. Leptophyllae

|2={{clade

|1=B. telmatiaea

|2=

}}

}}

}}

}}

2. If you use non-breaking whitespace to prevent wrapping, the subclades get squashed up. e.g.

{{clade

|label1=B. ser. Abietinae

|1={{clade

|1={{clade

|1=B. subser. Nutantes (2 taxa)

|2=B. subser. Longistyles (7 taxa)

}}

|2={{clade

|1=B. subser. Sphaerocarpae (5 taxa)

|label2=B. subser. Leptophyllae

|2={{clade

|1=B. telmatiaea

|2={{clade

|1=B. scabrella

|2={{clade

|1=B. leptophylla var. melletica

|2={{clade

|1=B. leptophylla var. leptophylla

|2=B. lanata

}}

}}

}}

}}

}}

}}

}}

3. Label widths are determined by the widths of labels of sister labels, but not of any other labels at the same rank. This looks silly when one unlabelled clade has a longer stem than all the others. This can be seen in the example above.

I have fiddled for hours in my sandbox, and I'm afraid all these problems have defeated me. If someone could possible figure out a solution, it would be much appreciated. Hesperian 05:37, 21 October 2007 (UTC)

:The collapse problem could probably be avoided by including invisible spacer elements, like the <div>s used in Template:Familytree. This may be as easy as including some &nbsp;s somewhere, but I haven't really looked at the code of this template closely enough to tell yet. I'm too tired to do that now, but I'll see if I can find some time for it later. One general suggestion I'd make, based on my experience with the familytree template, is to use HTML table syntax instead of wikitables: you're likely to see a significant improvement in the parsing speed of complex trees. —Ilmari Karonen (talk) 22:44, 27 October 2007 (UTC)

This template does not show up correctly in Safari and Konqueror. The latter passes the ACID2, so there must be some problems with the template itself. This template could be extremely useful (I've already used it in many articles), please fix these problems! Thank you very much! (see this discussion). Aelwyn 08:57, 3 November 2007 (UTC)

::See Template:Clade/doc#Limitations.

::When two sister clades are represented differently, one as a label for a subclade and the other as a leaf node, the layout may seem odd, as noted above. This is now discussed at Template:Clade/doc#Controlling_the_layout_of_sisters. Peter coxhead (talk) 10:27, 27 July 2011 (UTC)

:::Looking at my examples above, the problem has been fixed. It looked completely broken when I posted the comment back in '07. Hesperian 10:39, 27 July 2011 (UTC)

::::In my browser (Firefox), (1) isn't fixed (the lines don't join up), and (3) is still an issue, for which there are work-arounds. Peter coxhead (talk) 11:00, 27 July 2011 (UTC)

:::::Works for me on Firefox 5 and IE 8, still looks awful in Chrome 12. Hesperian 11:48, 27 July 2011 (UTC)

::::::Can I clarify this point with you please? (I'm still thinking about the clade template from time to time; I know how to fix the browser difference with extra user input, but not how to automate it. As far as I know, the manually constructed cladogram at User:Peter_coxhead/Test/Clade#Manual_fix_for_browser_difference looks the same in all browsers/platforms.)

::::::I use a Mac. When I look at the two cladograms below, the first is ok in all browsers. The second is not.

{{barlabel|align=centre|cladogram={{clade

|1={{clade

|label1=B. subser. Sphaerocarpae

|1=some taxa

|2=some taxa

}}

}}}}

{{barlabel|align=centre|cladogram={{clade

|1={{clade

|label1=B. subser.
Sphaerocarpae

|1=some taxa

|2=some taxa

}}

}}}}

::::::In Firefox, the second cladogram looks like the left hand image below. In Safari and Opera, it looks like the right hand image below.

Image:Browser_differences_with_clade_template_2.jpg

::::::Neither are correct. The Firefox version is better, but like the Safari/Opera version, the first "some taxa" lines up with the label, not the line.

::::::So on a Windows platform, does the second cladogram look ok in different browsers or not? (I would expect IE9 to look like the Firefox version; I'm not sure about IE8.) Peter coxhead (talk) 20:47, 27 July 2011 (UTC)

:::::::The right image is one of the problems I was complaining about in 2007. I now see the left image in Firefox 5 and IE 8 (on Windows). On Chrome I get something completely different as discussed elsewhere on this page. Hesperian 12:16, 28 July 2011 (UTC)

Editor

Just in case there are potential users who are put off by the complexity, there is a simple utility over here that may help Windows users create Cladograms by visually editing the trees. http://code.google.com/p/claded/downloads/list

I wrote it, but do not think I might get to extend it further or support feature requests or bug reports, but the source code is out there for improvement. Shyamal (talk) 12:29, 18 April 2008 (UTC)

other lines

Any possibility of dbl/triple lines for polyphyletic groups, or other common conventions? kwami (talk) 09:51, 25 November 2008 (UTC)

: See #Double lines. Peter coxhead (talk) 16:24, 1 February 2011 (UTC)

:It's now also easier to produce double lines by using {{tl|Cladex}}. Peter coxhead (talk) 08:30, 27 July 2011 (UTC)

Fixed width?

Is it possible to set a fixed width for the template? I know if you don't use the Template:Cladogram for naming and captions, you can enclose this template in a Template:userboxtop, like they have on Primate. But if you do that around a clade enclosed in a cladogram, it gets messed up. –Visionholder (talk) 20:29, 3 September 2009 (UTC)

{{cladogram|title=Lemur phylogeny

|caption=Source: Horvath, et al. (2008)

|clades={{Clade|style=font-size:75%;

|label1=Strepsirrhini 

|1={{Clade

|label1= Lorisiformes 

|1={{Clade

|1=Galagidae (Galagos)

|2=Lorisidae (Lorises)

}}

|label2= Lemuriformes 

|2={{Clade

|1=Daubentonia (Aye-aye)

|2={{Clade

|1={{Clade

|1=Indriidae (Sifakas, Indris, and Wolly lemurs)

|2={{Clade

|1=Lepilemuridae (Sportive lemurs)

|2=Cheirogaleidae (Mouse lemurs and allies)

}}

}}

|2=Lemuridae (Brown lemurs and allies)

}}

}}

}}

}}

}}

{{userboxtop| toptext= | extra-css=width:400px;}}

{{cladogram|title=Lemur phylogeny

|caption=Source: Horvath, et al. (2008)

|clades={{Clade|style=font-size:75%

|label1=Strepsirrhini 

|1={{Clade

|label1= Lorisiformes 

|1={{Clade

|1=Galagidae (Galagos)

|2=Lorisidae (Lorises)

}}

|label2= Lemuriformes 

|2={{Clade

|1=Daubentonia (Aye-aye)

|2={{Clade

|1={{Clade

|1=Indriidae (Sifakas, Indris, and Wolly lemurs)

|2={{Clade

|1=Lepilemuridae (Sportive lemurs)

|2=Cheirogaleidae (Mouse lemurs and allies)

}}

}}

|2=Lemuridae (Brown lemurs and allies)

}}

}}

}}

}}

}}

{{userboxbottom}}

{{-}}

{{reflist-talk}}

I don't understand your rationale, but the answer to your question is yes. Pass a width: value to the style parameter. e.g. in the above examples, replace

{{Clade|style=font-size:75%

with

{{Clade|style=font-size:75%; width:100em

Hesperian 23:16, 3 September 2009 (UTC)

:Thank you for the fix! I had tried passing a width parameter, but I must have had the syntax wrong. I'm not sure why Primate enclosed their cladogram in a Template:userboxtop, if that's what you meant by my "rationale," but I will probably go in and fix it for them soon. By the way... is the alignment syntax pretty straightforward? –Visionholder (talk) 17:37, 4 September 2009 (UTC)

::If you mean tweaking the alignment of clades within the cladogram, I don't think it can be done. If you mean getting the cladogram to center or float left instead of right, there's no provision for it at present.

::I've converted Primate to use {{tl|cladogram}}, but this doesn't really change anything, since {{tl|cladogram}} itself uses {{tl|userboxtop}} and {{tl|userboxbottom}}. Very odd.

::Hesperian 05:02, 5 September 2009 (UTC)

Depth problem with no warning

The cladogram at APG III system#Phylogeny seems to exceed the allowed depth without any warning. The very last part of the cladogram does not display (there should be another clade below "Apiales"). It's not present when I use "view source" in my browser to see the table generated by the template, although the template code seems to be correct. If I replace "Apiales" by {{clade ... }}, then I get a depth exceeded warning. Anyone able to fix this? Peter coxhead (talk) 08:20, 20 April 2010 (UTC)

Dashed lines?

Is there a way to add dashed lines for uncertain relationships? – VisionHolder « talk » 23:38, 20 May 2010 (UTC)

:Now there is: |stateN=dashed. Ucucha 20:38, 31 May 2010 (UTC)

Browser differences - Chrome vs. Firefox

{{multiple image

| align = right

| image1 = Drosera regia cladogram Firefox.jpg

| width1 = 200

| alt1 =

| caption1 = How the cladogram for Drosera regia looks in Firefox 3.6.8; "normal"

| image2 = Drosera regia cladogram Chrome.jpg

| width2 = 200

| alt2 =

| caption2 = Same cladogram in Google Chrome 6.0.472.59; "weird"

| footer =

}}

I just switched from using Firefox to Google Chrome and noticed some of my cladograms using this template and {{tl|cladogram}} look odd. Is this a fixable problem? Rkitko (talk) 13:28, 19 September 2010 (UTC)

:In Safari, they look as in Google Chrome. I guess it is related to how the browser interprets the empty table cells that {{tl|clade}} uses. I have no idea whether we can change the template so that Chrome and Safari interpret it the same way as Firefox does. Ucucha 14:57, 19 September 2010 (UTC)

::I hadn't opened IE in the longest time, but I braved it to satisfy my curiosity. The cladogram appears the same in IE as it does in Firefox. Perhaps some template guru could help? Rkitko (talk) 15:16, 19 September 2010 (UTC)

:::Firefox 3.6.10, IE 7.0.5730.13: as per left-hand screenshot. Chrome 6.0.472.59, Opera 10.62: as per right shot. --Redrose64 (talk) 16:02, 20 September 2010 (UTC)

::::If the problem is with empty table cells, one could put say a &thinsp; in the empty cells. I don't know if this would fix the problem, or make it worse. Plastikspork ―Œ(talk) 20:25, 3 October 2010 (UTC)

:::::I think there are already nbsp's in these cells. Ucucha 20:33, 3 October 2010 (UTC)

::::::I see. I checked the output source and found some <br>, but didn't see any nbsp. It could be my browser or mediawiki stripping them out. Plastikspork ―Œ(talk) 21:49, 3 October 2010 (UTC)

:::::::Non-breaking spaces don't help. the problem is (AFAICS) that Safari and Chrome are actually behaving correctly per W3 standards (in a somewhat obsessive way, perhaps), and this is mucking up the hack that lets the tables look nice in firefox. A two row table should normally determine row-height by the height of the contents (with the last row taking up the slack); it shouldn't assume that the rows get equal heights. If we knew in advance the height of the table, we could set the height of the table rows explicitly, (which solves the problem, more or less, in Safari) but I'm not yet seeing a way to resolve it in the abstract case. I've been debating whether it would be easier to convert the whole clade template to DIVs, but I think that would cause more problems than it solves. --Ludwigs2 21:54, 3 October 2010 (UTC)

:::::::P.s... There might be a solution by converting the #1 column (with the connector line) into a table as well. let me play with it a bit. --Ludwigs2 22:33, 3 October 2010 (UTC)

::::::::A lot of what you said above flies way over my head, so I appreciate any help you can offer :-) Rkitko (talk) 02:19, 4 October 2010 (UTC)

{{outdent}}As there has been no talk here I am thinking this may have been fixed with Chrome? but I am a Safari user and I still see the "weird" lines... (Just finished adjusting E.coli table and it looks hideous) --Squidonius (talk) 01:44, 27 July 2011 (UTC)

:No, it's still looking as bad in Chrome. Also, some of your most recent edits also messed up the cladogram in Firefox—the very long |label= texts are somehow pushing the branch down below its child nodes. Ucucha 02:15, 27 July 2011 (UTC)

::There's a discussion of browser differences below at #New version of clade template – look for the bold text "short answer". It's important to keep the {{mono|1=labelN=}} text as short as possible, and always use &nbsp; instead of real spaces in such labels. I have expanded Template:Clade/doc#Limitations to cover these issues. Peter coxhead (talk) 09:19, 27 July 2011 (UTC)

:::thanks. I did not notice that the internal node names were too long for IE to handle correctly, so I've fixed that. --Squidonius (talk) 11:46, 28 July 2011 (UTC)

:New versions of Chrome (I'm using Version 54.0.2840.99 m) seem to be rendering the tables the same way as Firefox. The cladograms for Drosera regia and Escherichia coli mentioned above both appear "properly" and so do other clade-based trees I've checked. Microsoft Edge also displays the trees in the desired way. I haven't checked Safari or Opera. Jts1882 (talk) 10:31, 5 December 2016 (UTC)

=Nowrap=

:::Is there any context in which we would need the |labelN= to wrap? If not, we could put {{tl|nowrap}} around them in this template. Ucucha 12:06, 28 July 2011 (UTC)

::::I think that the label must NEVER wrap; the results if it does are always incorrect on all browsers according to the tests I've made. The diagram below shows an example of what happens when the label is forced to wrap.

Image:Browser_differences_with_clade_template_2.jpg

::::In the Firefox/IE group of browsers (left-hand side), the result is not too bad, but the first "some taxa" lines up with the label, not the line. In Safari/Opera group (right-hand side), this problem is also present, but the lines are quite wrong.

::::I'm wary of making any changes to {{tl|clade}} because of the issue noted at Template:Clade#Large_cladograms. A further template expansion (i.e. the {{tl|nowrap}} template) will surely consume more resources and so break some existing large cladograms.

::::(Btw, I have written elsewhere that I know how to fix browser differences manually but not automatically. It turns out I was wrong; I can do it in all current browsers I've tested except IE9. Sigh...) Peter coxhead (talk) 17:18, 28 July 2011 (UTC)

:::::Do you know what exactly the problem is with large cladograms (i.e., what template limit is exceeded)? If the problem is the sheer size of the template text, there are quite a few spaces that can be removed from the code.

:::::We don't necessarily need to use the nowrap template; we can also use the raw tag (<span style="white-space:nowrap;">) instead. Ucucha 23:58, 28 July 2011 (UTC)

::::::I now see the problem is the expansion depth limit (WP:UNNEST), i.e. the maximum number of templates you can load inside another template. If we just add the span, that shouldn't affect the expansion depth limit. Ucucha 00:04, 29 July 2011 (UTC)

:::::::I agree, but I'm still wary! I'll experiment with a copy of the template in my user space + the cladogram at APG_III_system#Phylogeny whose first half is at the very limit of the current template's capacity. Peter coxhead (talk) 09:32, 29 July 2011 (UTC)

::::::::Tests showed that we were right, and this change does not alter the resource limit, so I have changed the template (I'll do the related {{tl|cladex}} later and fix the documentation of both). I'll post a new 'warning' note which is more likely to be read, perhaps. Peter coxhead (talk) 09:57, 29 July 2011 (UTC)

Double lines

There's a convention to show double lines for a paraphyletic group (e.g. a stem group). This is possible by the following trick. Use "stateN=double;border-bottom-width:3px;border-bottom-color:" for any line that you want to be double, where N = 1, 2, 3, etc. (Just "stateN=double" doesn't work because the line needs to be at least 3px thick to show as double.) There's an example at the source of Template:Clade euphyllophyte. Peter coxhead (talk) 16:29, 1 February 2011 (UTC)

:It's now easier to do this via {{tl|Cladex}}; see its documentation. Peter coxhead (talk) 09:25, 27 July 2011 (UTC)

How to highlight a path?

Is there a way to highlight a path from the origin to a leaf? I've used CSS background-color to highlight the leaf, but it's long way from the origin, and highlighting the path from the origin to the leaf would make it easier for readers. --Philcha (talk) 21:12, 13 April 2011 (UTC)

How to reduce space between lines?

Is there a way to space between lines (clades and leafs), to make it easier to see cladograms that take a lot of vertical space but without reducing the font size? --Philcha (talk) 21:12, 13 April 2011 (UTC)

:The spacing can be reduced a bit by putting "|style=line-height:100%" after the first "clade". Compare the first two versions below: the first is without any styling information, the second sets the line height to 100%. I now make a habit of always setting this value.

class="wikitable" border="1"
{{clade

|1={{clade

|1=Leaf 1

|2=Leaf 2

}}

|2=Leaf 3

}}

| {{clade|style=line-height:100%;

|1={{clade

|1=Leaf 1

|2=Leaf 2

}}

|2=Leaf 3

}}

| {{clade|style=font-size:80%;line-height:100%;

|1={{clade

|1=Leaf 1

|2=Leaf 2

}}

|2=Leaf 3

}}

:Unfortunately, setting line-height to less than 100% doesn't make any difference in my testing; to get things closer you need to reduce the font size. The third one above has "line-height:100%;font-size:80%". Peter coxhead (talk) 16:16, 14 April 2011 (UTC)

in line alignment and width

On Gammaproteobacteria, I cannot change the width, but I want it set to align=none (i.e. no word-wrapping). Is that due my incompetence or are they mutually exclusive? --Squidonius (talk) 21:21, 3 May 2011 (UTC)

:Try using the no-break space (&nbsp;) in place of spaces when you have lists of taxa. That will force it to stop word wrapping. Also remember to italicize genera. Cheers, Rkitko (talk) 21:43, 3 May 2011 (UTC)

Java clade processor applet

I'm currently working on the clade processor's parser. Does this BNF grammar look correct?

::= "{{User:Peter coxhead/Template/Clade" {