On 2 May 2017, at 10:02, Hussein Shafie wrote:

1) Adding an image map using the toolbar (http://www.xmlmind.com/xmleditor/_distrib/doc/help/adding_image_map.html) creates something like this:

---
<div>
  <img alt="???" src="???" usemap="#gi-z6bmc5" />
  <map id="gi-z6bmc5" name="gi-z6bmc5">
    <area alt="???" coords="???" href="???" shape="rect" />
  </map>
</div>
---

Thanks for pasting the code: At the end of your reply, you mentioned that HTML’s image map concept is not very 'tightly coupled'. True. But neither is the code that XXE inserts as tight as it could be:

One reason why I ended up with these problems was that I was not satisfied with XXE’s image map 'construction': Why that <div> wrapper? And why not wrap the <img> inside the <map>?

Thus I ended up editing the source/reshuffeling the elements - and thus I ended up with a new 'constructoin', which I finally wanted to copy and paste - rather than simply be satisfied with the result of the image insertion button.

So, why that div wrapper? Why not rather the following example?

---
    <map id="gi-z6bmc5" name="gi-z6bmc5">
      <img alt="???" src="???" usemap="#gi-z6bmc5" />
      <area alt="???" coords="???" href="???" shape="rect" />
    </map>
---

In additino to lowering the risk that I would reshuffle the elements, such a construction - which is valid - can be placed inline - e.g in the same paragraph one is working with. Whereas the current construct effectively creates a new paragraph - the div.

However, if you do consider the <div> to important for common users/usage, you could also do this - I myself might end up undoing the <div>, but I would not reshuffle the very image map elements:

---
    <div>
       <map id="gi-z6bmc5" name="gi-z6bmc5">
         <img alt="???" src="???" usemap="#gi-z6bmc5" />
         <area alt="???" coords="???" href="???" shape="rect" />
       </map>
    </div>
---

Even if this construct creates its own paragraph, if the user wants to place the map inside a currently existing paragraph, it is simple to copy the <map> and paste it, including the image, whereever one wants. This as apposed to the current construct, where the user must first select the <img>, and then (if they remember) the <map> - the result of which could easily become that <img> and <map> end up in different paragraphs/block elements, which is perfectly valid, but even more 'untight'.

(Workaround: I would rather prefer not to have to copy-paste. However, in case XXE continues to not wrapp the <img> inside the <map>, then I just discovered that, if I, after I have pasted an 'image map construction', simply remember to delete the img element, then XXE will delete the @name and the @id of the <map> as well - meaning that the errors are gone, and I can insert a new img inside the <map> and add new usemap+name/id values. It is a neat trick to remember, regardless.)

Notice that the newly created map is automatically given a unique ID.

2) In case two image maps (or any other element) have the same ID, the following validation message is displayed by the Validity tool:

---
[1] "unique" value "{gi-z6bmc5}" already in use
[cvc-identity-constraint.4.1]
---

For me this is less important than wrapping <img> in <map> (rather than in a <div>, se above), however: may be you should have a separate check for broken unique value map@name as well? Such a break could be highlighted by the validator as an image map error, might thus seem more relevant to the user. Perhaps it even could/should get a higher severity level than broken ID uniqueness ... On par with broken @coords ...

However it's true that the above cross-reference error(=least severe error) is NOT displayed when the document has more severe validity errors like this one:

---
[1] attribute "coords" has invalid value "???": "???" does not match pattern "(\s*(-?\d+)(\s*,\s*(-?\d+)){2,}\s*)" [cvc-pattern-valid] [cvc-attribute.3]
---

This second error is reported for any newly created HTML5 image map. It disappears after you use the image map editor (http://www.xmlmind.com/xmleditor/_distrib/doc/help/adding_image_map.html) to populate the newly created map with areas.

FYI: The image maps I experimented with did not have errors in @coords. It is true that I could have avoided the problem if I had kept myself alert about the broken unique ID constraint.

--> We will not implement what you suggest, even if we acknowledge that in some rare cases (copy/paste the same map at different places) the behavior of XXE is suboptimal.

Also note that this issue only occurs in HTML documents; all this cannot happen with DITA or DocBook "image maps", where an image and its map are more "tightly coupled".

Due, perhaps, to HTML’s untight concept, it is, I believe, a somewhat common confusion for authorsw, even when working directly with the code, that <img> and <map> becomes disconnected. So I disagree a little that it is rare.
--
leif halvard silli
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to