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

Core: Drop workarounds for unsupported browsers #267

Merged
merged 1 commit into from Jun 16, 2014
Merged

Conversation

mgol
Copy link
Member

@mgol mgol commented Jun 9, 2014

One test could be dropped. There is also a detectDuplicates one that claims is for Chrome before version 14 but even in current Chrome this test returns false (true in other browsers). What's going on here?

cc @gibson042

@@ -509,18 +509,6 @@ setDocument = Sizzle.setDocument = function( node ) {
return !div.getElementsByTagName("*").length;
});

// Check if getElementsByClassName can be trusted
support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't drop the rnative test. This avoids oldIE attempting to call a method that doesn't exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we're lacking tests here then since the test suite passes in oldIE on my branch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errors of that nature have been hard to pin down in tests, which is why we've adopted the style.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it works because in both cases where getElementsByClassName is used there's a check if it exists.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that kind of check has shown to be problematic. In jQuery, we use typeof. In Sizzle, we use rnative.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we don't support getElementsByClassName polyfills.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speaking of, looks like some jQuery flavor made it into the CLASS find method (typeof). Let's change that to use rnative as well for consistency.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@timmywil
Copy link
Member

timmywil commented Jun 9, 2014

Chrome messes with our sorting algorithm. Chrome assumes duplicates are sorted, but we want to remove them.

@mgol
Copy link
Member Author

mgol commented Jun 9, 2014

Chrome messes with our sorting algorithm. Chrome assumes duplicates are sorted, but we want to remove them.

The problem is not limited to old Chrome versions then, is it?

@timmywil
Copy link
Member

timmywil commented Jun 9, 2014

It's historically been a webkit issue, but iirc, it is now a sorting (de)optimization limited to Chrome.

@timmywil
Copy link
Member

timmywil commented Jun 9, 2014

I mean, if you're seeing it in Chrome latest, then yes, it is still there.

@mgol
Copy link
Member Author

mgol commented Jun 9, 2014

PR updated.

}
};
// Support: IE<9 (getElementsByClassName check)
Expr.find["CLASS"] = ( support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) ) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see the support.getElementsByClassName assignment remain up with the other support checks so we have a single place to look.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK; I moved it here to be consistent with the rest of similar cases, e.g. support.qsa is set inline. I'll move it back.

@mgol
Copy link
Member Author

mgol commented Jun 11, 2014

Changes applied.

return div.getElementsByClassName("i").length === 2;
});
// Support: IE<9
support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant docElem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Err, I guess either works.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if there's a browser that has it on document but not elements.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just left what was here before so it should work. ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okies

@mgol mgol merged commit 08cb451 into jquery:master Jun 16, 2014
@mgol mgol deleted the support branch June 16, 2014 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants