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

The constructor should be exposed #5

Open
domenic opened this issue May 8, 2014 · 6 comments
Open

The constructor should be exposed #5

domenic opened this issue May 8, 2014 · 6 comments

Comments

@domenic
Copy link

domenic commented May 8, 2014

That way you can do things like new Elements(document.query('#a'), document.query('#b')).queryAll('.c'). Similar to jQuery's $('#a').add($('#b')).find('.c'). Basically any situation where you might programmatically construct a set of elements.

@bloodyowl
Copy link
Contributor

I gave some thoughts about it when I did the PR, and as Elements doesn't rely on a proper array subclass, is it really wise?

@domenic
Copy link
Author

domenic commented May 8, 2014

as Elements doesn't rely on a proper array subclass, is it really wise?

What do you mean?

@domenic
Copy link
Author

domenic commented May 8, 2014

Oh, I see, the constructor wasn't implemented correctly. Well, that seems like a bug...

@bloodyowl
Copy link
Contributor

when the browser does not support __proto__ or Object.setPrototypeOf we would have inconsistencies across browsers (i.e. if we take the array from an iframe, no inheritance from array prototype)

not sure if a solution like this is really profitable for older browsers.

@barberboy
Copy link
Owner

Dominic, can you point me to any documentation about the Elements constructor? It looks like you are wanting different behavior than the Array constructor anyway, like flattening array-like arguments.

@domenic
Copy link
Author

domenic commented May 16, 2014

No, it just inherits the Array constructor.

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

3 participants