Obviously it is possible to come with its own solution using the JSNI (java script native integration) and return the nodeName attribute of a DOM element, here is what I wrote:
public class Utils
{
/**
* Returns an element tag name.
*
* @param element the element to obtain the tag name from
* @return the tag name value
*/
public static native String getTagName(Element element)
/*-{
// It should work with all browsers, if it does not, replace that with more appropriate code :-)
return element.nodeName;
}-*/;
}
There is probably a good reason explaining why it is not possible to get such a value, but for now it is unknown to me.
No comments:
Post a Comment