Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6556587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:57:50+00:00 2026-05-25T12:57:50+00:00

Is there a function or something to get the interface of an object? Like,

  • 0

Is there a function or something to get the interface of an object?

Like, for <p/> = HTMLParagraphElement, how would I retrieve it?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:57:51+00:00Added an answer on May 25, 2026 at 12:57 pm

    I think there are just one way to do so: fetch a list of all available interfaces, iterate via this list and check your variable value for type using instanceof operator.

    This way should work like following:

    var element = ... // here your element comes
    var interfaces = [HTMLParagraphElement, HTMLDivElement];
    var interface = interfaces.filter(function (x) { return element instanceof x; })[0].toString();
    

    Now you get something like function HTMLParagraphElement() { [native code] } in interface variable (if element is <p />). I assume this only works for V8 (Google Chrome). Now you can use regexies to extract interface name.

    interface.match(/function (.+)\(\)/)[0]
    

    To get list of all interfaces you can use following (works only for HTML elements):

    var interfaces = [];
    for (var key in window) {
      if (key.indexOf('HTML') == 0)
        interfaces.push(window[key]);
    }
    

    I agree with duri’s answer, so you don’t need to enumerate all interfaces, using of constructor method is more easy way to get prototype function. After that you can use regex I wrote to extract interface name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have something like this: uses MSXML2_TLB; type TDocumentType = (dtOrder, dtInvoice, dtStatus, dtError);
I need to write a function that accepts an object , but I want
Ok. So I have a list of values, and I'd like to do something
I have narrowed down an ugly bug, but since it seems like something internal
Is there a way in PHP to overwrite a method declared by one interface
Is there any way to save an entire class definition for a C# object
I have a C++ class that I'm using, and there's a function in it
I want a function with this interface. func<Type1,CompileOption>( Type2 value) //or func<Type1>( Type2 value)
The idea is to create a DOM-like tree. But there are some restrictions, that
Is there any way to set an array recursively? something along these lines: $array

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.