I have an SVG document in which I use JavaScript to highlight elements on hover. My elements have names - some elements have the same name because, although they appear several times, they logically refer to the same thing. When one instance of the replicated element is obscured, I want them all to be highlighted.
To make a selection, I look at the name of the element that is being washed. Then I call document.getElementsByName()to find all the elements that share this name. With the returned array of elements, I iteratively apply the appropriate style for the selection.
This works fine on WebKit and doesn't work on Gecko - the latter tells me that it getElementsByNameis undefined. Which is looking at the functions of the table to documentreally takes place: getElementsByClassName, getElementsByTagName, getElementsByTagNameNSeverything is there; getElementsByNamemissing.
Any ideas on why Gecko leaves this selector? Google was useless in this question (although maybe I asked the wrong questions).
Any suggestions for a compact workaround for Gecko do not support this selector? I would rather not get carried away with the class attribute or (even worse) generate unique identifiers for my repeating instances to complete the task.
source
share