[go: up one dir, main page]

Page MenuHomePhabricator

imagemap creates duplicate names
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • on a new page, create 2 identical <imagemap> tags with identical content (including size)
  • note that the maps generated, have identical names. (e.g. <map name="ImageMap_d4cc6d14751f9bd4">)
  • also note that this is illegal, as noted here: basically, ids and names share the same namespace, and it's illegal to have 2 identical ids, 2 identcal names, or an id and name which are identical

this seems like a small and insignificant violation, but it breaks some scripts, and confuses the DOM.

What happens?:
imagemap extension creates non-unique names

What should have happened instead?:
imagemap extension should create unique names

Software version (skip for WMF-hosted wikis like Wikipedia):
up to and including 1.40.0-wmf.20 (212529a)

Other information (browser name/version, screenshots, etc.):

specific scripts affected: "imagemapHighLight, used on hewiki, ruwiki, and elsewhere.

Event Timeline

Just an idea for a possible solution: add the number

$('body').find('*').index(<current map or image dom element>)

to the hash function input.

Small patch to make all names to random ImageMap_6669158 format using the standard random_int function and 7 digit numbers. In case random_int values collide, the names are regenerated on page cache refresh.
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ImageMap/+/1057620

Change #1057620 had a related patch set uploaded (by Oreolek; author: Oreolek):

[mediawiki/extensions/ImageMap@master] Use a random ID for each ImageMap

https://gerrit.wikimedia.org/r/1057620