0
votes

I have three variables: foo, bar, and test.

They are the following objects: an Ext.Component, an Ext.Element, and an HTMLElement (or a DOM node).

  1. How would you identify which one is which? E.g. foo.isExtElement()

  2. How would you find other two related objects for every variable? E.g. find corresponding Ext.Element and HTMLElement given you already know that foo is an Ext.Component. And so on.

(I can't add an [htmlelement] tag due to low reputation)

EDIT:

Added example to #1 and as per @kevhender replaced "convert" with "find".

1

1 Answers

2
votes

The question itself doesn't really make sense. You wouldn't ever "convert" any of these into another... These are 3 different, distinct types of variables, each with their own purpose.

I've already addressed the differences between these three types in my answer to your last question: https://stackoverflow.com/a/18855938/2072693

I wouldn't call these a "conversion", but here are the ways to get one of these types from another:

component.getEl()  //gets the Ext.Element of the top level of the component
component.getEl().dom  //gives the HTMLElement of the top level of the component
element.dom   //gets the HTMLElement from the Ext.Element
Ext.get(htmlElement)  //allows for using Ext.Element methods on an HTMLElement

There is no built-in way to get an Ext.Component from an Ext.Element or HTMLElement -- in fact, it wouldn't really make sense.