Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no decent way to get the original values of WebIDL constants #9

Open
bzbarsky opened this issue May 31, 2018 · 2 comments
Open

Comments

@bzbarsky
Copy link

getOriginalProperty doesn't allow a target that is a WebIDL prototype or constructor. So to use it to get a constant you have to get an instance of that interface and that as target.

None of the other APIs being introduced here return WebIDL constants.

@domenic
Copy link
Owner

domenic commented May 31, 2018

Yeah, this is intentionally noted as not a supported capability:

// Non-method statics: use the actual constant values instead

Do you think we should make this clearer? Or, do you think this capability is important and we should make it possible somehow?

@bzbarsky
Copy link
Author

It's only important in the sense of making it simpler to write code using these primitives.

That said, I guess if you want to do Node.DOCUMENT_NODE you can get the original Node constructor and then just get its .DOCUMENT_NODE. It's non-configurable and non-writable so this is safe... as long as you know for sure it's there at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants