Skip to content

Commit c623f83

Browse files
committed
SVG images are interactive
Images created with the `image` JME function were all marked as non-interactive. But SVG images have an event listener attached to the 'load' event to do variable substitution, so they must be considered interactive.
1 parent 242dbe5 commit c623f83

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

runtime/scripts/jme-builtins.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,10 @@ newBuiltin('image',[TString, '[number]', '[number]'],THTML,null, {
364364
}
365365
var subber = new jme.variables.DOMcontentsubber(scope);
366366
var element = subber.subvars(img);
367-
element.setAttribute('data-interactive', 'false');
367+
368+
// The subber replaces SVG images with <object> tags which have an event listener for when the content loads, so they must be considered interactive.
369+
element.setAttribute('data-interactive', element.tagName.toLowerCase() == 'object');
370+
368371
return new THTML(element);
369372
}
370373
});

runtime/scripts/jme-variables.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,6 @@ DOMcontentsubber.prototype = {
804804
return element;
805805
} else if(tagName=='img') {
806806
if(element.getAttribute('src').match(/.svg$/i)) {
807-
element.parentElement
808807
var object = element.ownerDocument.createElement('object');
809808
for(var i=0;i<element.attributes.length;i++) {
810809
var attr = element.attributes[i];

0 commit comments

Comments
 (0)