Hi, I've been developing a text editor based on SVG, and I'm now trying to make it so that multiple instances can be instantiated in a single SVG document. The way I've been trying to achieve this is to wrap the DOM representation of each text editor instance with a single parent element (either <g> or <svg>), and then to attach a keypress event listener to that parent element. The problem I'm running into, though, is it seems that keypress events are only received by the document root. Furthermore, for all browser SVG implementations I've tried, the target, originalTarget, and explicitOriginalTarget event properties, when they exist, are also set to the document root, so it doesn't event seem like it's possible to hack a solution by attaching a single event listener on the document root, and then manually dispatching events by reading the event's originalTarget property.
So far, I've tested Firefox 3.6, Chromium 9, Opera 11, and Batik Squiggle 1.7, with the following test case: http://stuff.echo-flow.com/svg-developers/testEventListener.svg Only Batik works as expected, with the rect element receiving the keypress event. In Firefox, target, originalTarget, and explicitOriginalTarget are all equal to the root element. In Chromium and Opera, target is set to the root element, and originalTarget and explicitOriginalTarget are undefined. Basically, what I'm trying to do is relate a keypress event back to the element that originally fired it. I think I could probably get this to work if I used an HTML context and embedded iframes; or, if I used iframes inside of a foreignObject. But I'm wondering if there's a cleaner workaround that does not require the use of iframes. Furthermore, I guess as a worst-case scenario, I could do my own hit testing by inspecting the clientX/clientY properties of the keypress event, and comparing that to the bboxes of all text editor group elements. But once again, this seems very hacky, and I wonder if there's a better approach. I'd appreciate any insight anyone can offer. Thanks, Jake ------------------------------------ ----- To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ----Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/svg-developers/join (Yahoo! ID required) <*> To change settings via email: svg-developers-dig...@yahoogroups.com svg-developers-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: svg-developers-unsubscr...@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/