Ability to retrieve tagName #187

Closed
kishorenc opened this Issue Apr 8, 2013 · 6 comments

3 participants

@kishorenc

Ideally, in jQuery's style: $ele.prop('tagName')

@matthewmueller

You can do $ele[0].name

@kishorenc

That's what I am doing right now. But, I am working on a project where the code is executed both on the server side and in the browser, and doing $ele[0].name does not work in the browser. An alternative approach would be the availability of a .get() method, so I can do $ele.get(0).name on both the client and server side.

Right now I am using feature detection to deal with both environments.

@matthewmueller
@kishorenc

Thanks - yes, that indeed works. This issue is more about maintaining consistency with jQuery's API.

@matthewmueller
@jeremy-dentel

You could try doing something like...

var tagName = elem[0].tagName || elem[0].name;

Should work in browser & server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment