Re: Bug report: /> and then </a> tag on new line

The short version of this bug report is that Amaya takes a file which,
as far as I know, is valid HTML:

  http://www.firstpr.com.au/temp/amaya/amaya-test-10.html

with a hyperlink which only encompasses an image, and forces a change in
it so there is an extra visible space enclosed in the hyperlink:

  http://www.firstpr.com.au/temp/amaya/amaya-test-11.html

The space appears on browsers as a blue underline to the right of the
image, but Amaya does not show this blue line.  As I explore below, it
seems that Amaya's internal conception of an image is that it has a
newline after it.

I wrote of how Amaya displays the original file:

> > However Amaya displays an anomalous light blue tilde after the </a>
> > width="319"></a>~

Irene wrote:

> Amaya does a good job here as it shows you that there is a non-breaking space 
> and a space after the image.

Ah yes, looking at the original file I see there is A0 20 before the two
newline characters.

The problem is that Amaya changes:

  width="319"></a>

to:

  width="319" />
  </a>

The extra space and slash to end the "<img" tag with " />" is valid
XHTML and HTML, following the requirements and guidelines in:

  http://www.w3.org/TR/xhtml1/#h-4.6       Empty Elements
  http://www.w3.org/TR/xhtml1/#guidelines  C.2

because the <img ... > is an "empty element", due to it not enclosing
other things, like "<em>blah</em>".


The problem is that Amaya has inserted a newline before the "</a>".

This is correctly interpreted by browsers as a whitespace character.

Irene wrote:

> In the source, you can add several spaces and newlines where there is
> a space provided that the enclosing element is not a <pre> or an XML
> element with the attribute xml:space="preserve".

But in this case, the original had no space before the "</a>".

A secondary problem is that when Amaya displays this, it does not show a
blue underline for the space which is now to the right of the image.

I chopped things out of the original file progressively to try to find
something simpler which would cause Amaya not to add the unwanted newline.

I removed the non-breaking space, the space and the two newlines after
"</a>" and the problem still occurred.

I generated a new file (XHTML Transitional, iso-8859-1. typing things in
manually to produce the following source.  I typed "xxxx" a newline and
then inserted an image.


<body>
<p>xxxx</p>

<p><img alt="Photos of Queensland Daintree rainforest and beach"
src="show-and-tell-green-ants-310x300.jpg" />
</p>
</body>


This  puts a space, in the form of a newline, after the image.  That
space is not displayed by Amaya or Mozilla, probably because trailing
spaces at the end of paragraphs.

Changing Preferences > Publishing > Fixed line length to "200" does not
alter the way Amaya puts a newline before the </p>.

This file is at:

  http://www.firstpr.com.au/temp/amaya/amaya-test-20.html

It is possible to delete the newline in View Source, and save the file:

  http://www.firstpr.com.au/temp/amaya/amaya-test-21.html

Amaya loads this and the View Source shows that no newline has been
added.  However, if I make a change, such as adding a 'y' after "xxxx"
then in View Source, the newline has been added again.


If I repeat the exercise by creating a new file, typing xxxxyyyy and
then placing the cursor in the middle of this before inserting the
image, I get:

<body>
<p>xxxx<img alt="Photos of Queensland Daintree rainforest and beach"
src="show-and-tell-green-ants-310x300.jpg" />
yyyy</p>
</body>

This is at:

  http://www.firstpr.com.au/temp/amaya/amaya-test-30.html

So it seems that Amaya is keen to put a newline after the image, no
matter whether the image is in a hyperlink or a paragraph.

It seems that when Amaya looks at its internal data after an edit in the
main view, it correctly parses the image without the newline, and
replaces it with the image plus the newline.

In this state, Amaya displays both versions, with and without a newline,
with no space between the image and the "yyyy" - unless I reload the files!

This is incorrect.  Mozilla, Firefox, MSIE 6 and Opera 9 all show a
space, as they should.

Unless I reload the file, it is clear that the display does not show the
space created by the newline.  Stepping the cursor from far left to the
right in this file, step 4 has the cursor to the right of "xxxx", but
only a little of it is visible behind the bottom left of the image.
Step 5 has the cursor along the whole left edge of the image.  Step 6
has it on the whole right edge.  Step 7 has it in the same location
horizontally, but only a character high.

Deletion at step 6 or 7 removes the first 'y'.  Deletion at step 5 or 6
deletes the image and newline.

So (without reloading the file) it is impossible to see or delete the
newline from the main editing view.

However, if I reload the file, the space is displayed and deletion at
step 6 (which is to the left of the space to the left of "yyyy") removes
the visible space.  This does not change the source - the newline is
still present after the "/>".  The saved file is unchanged from the
original.

The state Amaya with the initially created file (not after a reload) can
be recreated by opening:

  http://www.firstpr.com.au/temp/amaya/amaya-test-30.html

placing the cursor immediately to the left of "yyyy", moving the cursor
one to the left and then pressing delete.

  - Robin

Received on Thursday, 26 October 2006 02:43:23 UTC