Skip to content

Commit

Permalink
Tests: Disable the ":lang respects escaped backslashes" test
Browse files Browse the repository at this point in the history
Firefox 114+ no longer match on backslashes in `:lang()`, even when escaped.
It is an intentional change as `:lang()` parameters are supposed to be valid
BCP 47 strings. Therefore, we won't attempt to patch it.
We'll keep this test here until other browsers match the behavior.

Fixes gh-5271
Closes gh-5277
Ref https://bugzilla.mozilla.org/show_bug.cgi?id=1839747#c1
Ref w3c/csswg-drafts#8720 (comment)

(cherry picked from commit 62b9a25)
  • Loading branch information
mgol committed Jun 27, 2023
1 parent 141518e commit 5aa7d93
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions test/unit/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ QUnit.test( "pseudo - :target and :root", function( assert ) {
} );

QUnit.test( "pseudo - :lang", function( assert ) {
assert.expect( QUnit.jQuerySelectors ? 105 : 55 );
assert.expect( QUnit.jQuerySelectors ? 104 : 54 );

var docElem = document.documentElement,
docXmlLang = docElem.getAttribute( "xml:lang" ),
Expand Down Expand Up @@ -1598,8 +1598,18 @@ QUnit.test( "pseudo - :lang", function( assert ) {
anchor.parentNode.lang = "ara";
anchor.lang = "ara\\b";
assert.deepEqual( jQuery.find( ":lang(ara\\b)", foo ), [], ":lang respects backslashes" );
assert.deepEqual( jQuery.find( ":lang(ara\\\\b)", foo ), [ anchor ],
":lang respects escaped backslashes" );

// Support: Firefox 114+
// Firefox 114+ no longer match on backslashes in `:lang()`, even when escaped.
// It is an intentional change as `:lang()` parameters are supposed to be valid
// BCP 47 strings. Therefore, we won't attempt to patch it.
// We'll keep this test here until other browsers match the behavior.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1839747#c1
// See https://github.com/w3c/csswg-drafts/issues/8720#issuecomment-1509242961
//
// assert.deepEqual( jQuery.find( ":lang(ara\\\\b)", foo ), [ anchor ],
// ":lang respects escaped backslashes" );

assert.throws( function() {
jQuery.find( "#qunit-fixture:lang(c++)" );
}, ":lang value must be a valid identifier" );
Expand Down

0 comments on commit 5aa7d93

Please sign in to comment.