<@doc hierarchy="GMLDOM"> Implements Object that wraps HTML element(s). Useful to create Object that is able to handle HTML events from its HTML elements. (c) SAP AG 2003-2006. All rights reserved. Class HtmlObject inherit core.gml:Object; property elem = null; constructor(elem) this.supercall(); if (elem) this.attachElement(elem); end method attachElement(elem) if (!elem) return; this.detachElement(); elem.htmlObject = this; this.elem = elem; end method detachElement() if (!this.elem || !this.elem.htmlObject) return; this.elem.htmlObject = null; this.elem = null; end // We cannot use Global.js: makeEventHandler here because we're in a diferent HTML scope // NOTE: Think to move makeEventHandler to core.lib:Global.js - then it can be used here method setEventHandler(name, handler) if (!this.elem) return; if (!handler) { this.elem[name] = null; return; } var obj = this; this.elem[name] = function() { if (!obj || !obj.elem || !obj.elem.htmlObject) return; try { // // We use event object from the element (this) and not window.event, because we can // sit in another HTML window, so that window.event is set to something else or null. // var evt = this.document.parentWindow.event; if (!evt) return; return handler.apply(obj, [evt]); } catch (e) { #LOG[4, 'HtmlObject(' + (obj ? 'null' : obj.Class.name) + '): exception when handling "' + name + '" event: ' + e.description]; } } end