Skip to content

Commit

Permalink
add test for gap in flex display mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dugalh committed May 4, 2023
1 parent ae3887f commit 3f35306
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions site/_static/scripts/browser-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,26 @@ function themeSupport(urlRoot) {
// return query.split(/[^A-Za-z0-9_]+/g).filter(function(term) { return term; });
// }

function flexGapSupport() {
// create flex container with row-gap set
var flex = document.createElement("div");
flex.style.display = "flex";
flex.style.flexDirection = "column";
flex.style.rowGap = "1px";

// create two, elements inside it
flex.appendChild(document.createElement("div"));
flex.appendChild(document.createElement("div"));

// append to the DOM (needed to obtain scrollHeight)
document.body.appendChild(flex);
var isSupported = flex.scrollHeight === 1; // flex container should be 1px high from the row-gap
flex.parentNode.removeChild(flex);

return isSupported;
}


function browserSupport() {
var urlRoot = document.getElementById("documentation_options").getAttribute('data-url_root');
webpSupport();
Expand Down
2 changes: 1 addition & 1 deletion site/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
html_css_files = ['styles/leftfield.css']
# searchtools.js is a theme script that is always incuded, but is specified here to make sure it is
# listed in the html before browser-support.js, which uses it.
# html_js_files = ['scripts/browser-support.js']
html_js_files = ['scripts/browser-support.js']
html_context = {'default_mode': 'auto'} # use the system/browser light/dark theme setting
# html_favicon = '_static/favicons/favicon.svg'
html_sourcelink_suffix = ''
Expand Down

0 comments on commit 3f35306

Please sign in to comment.