Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit15750b0

Browse files
authored
Selector: Use shallow document comparisons in uniqueSort
IE/Edge sometimes crash when comparing documents between frames using the strictequality operator (`===` & `!==`). Funnily enough, shallow comparisons(`==` & `!=`) work without crashing.The change to shallow comparisons in `src/selector.js` was done ingh-4471 butrelevant changes in `src/selector/uniqueSort.js` were missed. Those changeshave landed in Sizzle injquery/sizzle#459.Fixesgh-4441Closesgh-4512Refgh-4471Refjquery/sizzle#459
1 parentf09d921 commit15750b0

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

‎src/selector/uniqueSort.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ function sortOrder( a, b ) {
2424
}
2525

2626
// Calculate position if both inputs belong to the same document
27-
compare=(a.ownerDocument||a)===(b.ownerDocument||b) ?
27+
// Support: IE 11+, Edge 17 - 18+
28+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
29+
// two documents; shallow comparisons work.
30+
// eslint-disable-next-line eqeqeq
31+
compare=(a.ownerDocument||a)==(b.ownerDocument||b) ?
2832
a.compareDocumentPosition(b) :
2933

3034
// Otherwise we know they are disconnected
@@ -34,11 +38,20 @@ function sortOrder( a, b ) {
3438
if(compare&1){
3539

3640
// Choose the first element that is related to the document
37-
if(a===document||a.ownerDocument===document&&
41+
// Support: IE 11+, Edge 17 - 18+
42+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
43+
// two documents; shallow comparisons work.
44+
// eslint-disable-next-line eqeqeq
45+
if(a==document||a.ownerDocument==document&&
3846
jQuery.contains(document,a)){
3947
return-1;
4048
}
41-
if(b===document||b.ownerDocument===document&&
49+
50+
// Support: IE 11+, Edge 17 - 18+
51+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
52+
// two documents; shallow comparisons work.
53+
// eslint-disable-next-line eqeqeq
54+
if(b==document||b.ownerDocument==document&&
4255
jQuery.contains(document,b)){
4356
return1;
4457
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp