stop using invalid pseudo selector

This is to fix a failing test and analytics UI
blocking upgrade to jquery 2.0

the is(':visible') pseudo selector is invalid
on $(window) in jquery 2.0, by design

see https://bugs.jquery.com/ticket/14709/

refs FOO-4258
flag=none

Test Plan:
- Jenkins passes

[skip-crystalball]

Change-Id: I5d888d957d29721c6b0f4747f6542e737a9eedc3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/340988
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Angela Gomba <angela.gomba@instructure.com>
QA-Review: Jen Smith <jen.smith@instructure.com>
Product-Review: Jen Smith <jen.smith@instructure.com>
This commit is contained in:
Jen Smith 2024-02-21 12:38:29 -08:00
parent 6629e7c1ed
commit 315c5c4853
2 changed files with 5 additions and 4 deletions

View File

@ -42,9 +42,9 @@ describe "jquery" do
expect(driver.execute_script("return $('form input[name=_method]').val()")).to eq "delete"
end
it "is able to handle ':hidden' and ':visible' pseudo-selector on window" do
it "is able to handle ':hidden' and ':visible' pseudo-selector on document body" do
get("/login")
expect(driver.execute_script("return $(window).is(':visible')")).to be true
expect(driver.execute_script("return $(window).is(':hidden')")).to be false
expect(driver.execute_script("return $(document.body).is(':visible')")).to be true
expect(driver.execute_script("return $(document.body).is(':hidden')")).to be false
end
end

View File

@ -31,7 +31,8 @@ function PaginatedView() {
PaginatedView.prototype.paginationLoaderTemplate = template
PaginatedView.prototype.paginationScrollContainer = window
// set default scroll container to window.document.body, because as of jquery 2.0, $(window).is(':visible') is no longer supported, see https://bugs.jquery.com/ticket/14709/
PaginatedView.prototype.paginationScrollContainer = window.document.body
PaginatedView.prototype.distanceTillFetchNextPage = 100