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

[IE8] Array.prototype.slice.call(NodeList) fails #408

Closed
WebReflection opened this issue Sep 15, 2016 · 9 comments
Closed

[IE8] Array.prototype.slice.call(NodeList) fails #408

WebReflection opened this issue Sep 15, 2016 · 9 comments

Comments

@WebReflection
Copy link
Member

WebReflection commented Sep 15, 2016

Literally what the subject says:

Array.prototype.slice.call(document.querySelectorAll('*'));

This code fails in IE8.
The debugger points at these lines:

es5-shim/es5-shim.js

Lines 271 to 276 in 922bfc2

// equiv: target.call(this, ...boundArgs, ...args)
return apply.call(
target,
that,
array_concat.call(args, array_slice.call(arguments))
);

live test page that fails in IE8:
http://webreflection.github.io/document-register-element/test/examples/ie8.html

@ljharb ljharb self-assigned this Sep 15, 2016
@ljharb
Copy link
Member

ljharb commented Sep 15, 2016

I believe this is caused by #99.

@Xotic750
Copy link
Contributor

On MSDN they fix this by testing

  try {
    // Can't be used with DOM elements in IE < 9
    _slice.call(document.documentElement);
  } catch (e) { // Fails in IE < 9

and then use a hand written slice instead of native call. I don't think it's the apply with non-array issue?

@WebReflection
Copy link
Member Author

any update on this?

@ljharb
Copy link
Member

ljharb commented Sep 20, 2017

No update just yet; I'd like to fix it but haven't had the time to do so. A PR to fix this would be quite welcome.

@WebReflection
Copy link
Member Author

TBH, I just went maintenance mode today and went through all issues I've opened/left behind: this was one of them.

I believe the PR would be something like:

try {
  array_slice.call(document.documentElement.childNodes);
} catch(o_O) {
  array_slice = function () {
    for (var r = [], i = this.length; i--; r[i] = this[i]);
    return r.slice.apply(r, arguments);
  };
}

'cause I couldn't care less about IE8 performance ... but I also have no time for an official PR and tests here, sorry about that

@WebReflection
Copy link
Member Author

no interest in this

@ljharb
Copy link
Member

ljharb commented Nov 15, 2017

I still have interest in it.

@ljharb ljharb reopened this Nov 15, 2017
@WebReflection
Copy link
Member Author

OK, I am not going to do anything about it, hence I'd like to remove this ticket from my list of Github issues

@WebReflection
Copy link
Member Author

do you mind opening another issue so this disappears from my list of issues? thanks

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

No branches or pull requests

3 participants