From c3c77cb88aaf4bad874855ac9a45c51b6475e14c Mon Sep 17 00:00:00 2001 From: Charles Law Date: Tue, 25 Jan 2022 14:54:03 -0800 Subject: [PATCH] Use CSSOM to set styles to avoid Content Security Policy warnings --- src/jsgrid.core.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/jsgrid.core.js b/src/jsgrid.core.js index 1138881f..4b4c1ea5 100755 --- a/src/jsgrid.core.js +++ b/src/jsgrid.core.js @@ -931,11 +931,19 @@ return function() { if(result === undefined) { - var $ghostContainer = $("
"); - var $ghostContent = $("
"); + var $ghostContainer = $("
"); + var ghostContainer = $ghostContainer.get(0); + ghostContainer.style.width = "50px"; + ghostContainer.style.height = "50px"; + ghostContainer.style.position = "absolute"; + ghostContainer.style.top = "-10000px"; + ghostContainer.style.left = "-10000px"; + var $ghostContent = $("
"); + var ghostContent = $ghostContent.get(0); + ghostContent.style.height = "100px"; $ghostContainer.append($ghostContent).appendTo("body"); var width = $ghostContent.innerWidth(); - $ghostContainer.css("overflow-y", "auto"); + $ghostContainer.get(0).style.overflowY = "auto"; var widthExcludingScrollBar = $ghostContent.innerWidth(); $ghostContainer.remove(); result = width - widthExcludingScrollBar;