-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[STALLED] Feature/4172 eliminate render blocking resources #4604
base: develop
Are you sure you want to change the base?
Changes from 10 commits
3d275b1
a8475f5
d7bfbb0
8fb6ebc
5c9c828
0e18cd5
6fcdf9f
46baead
d992b00
1eefc42
9ef5020
594c179
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ <h2 id="hero-heading">Protecting the integrity of the campaign finance process</ | |
{% home_page_banner_announcement %} | ||
|
||
<section class="slab"> | ||
{% comment %} | ||
{% comment %} | ||
Below is for featured icon+links in Wagtail html block only...for now. | ||
{% endcomment %} | ||
{% for block in self.body %} | ||
|
@@ -105,31 +105,32 @@ <h1>Commissioners</h1> | |
if (!canSkipPolyfills) { | ||
var pfScriptElem = document.createElement('script'); | ||
pfScriptElem.async = false; | ||
pfScriptElem.defer = false; | ||
pfScriptElem.src = "{% asset_for_js 'polyfills.js' %}"; | ||
document.head.appendChild(pfScriptElem); | ||
} | ||
</script> | ||
<script src="{% asset_for_js 'home.js' %}"></script> | ||
<script src="{% asset_for_js 'bythenumbers.js' %}"></script> | ||
<script src="{% asset_for_js 'dataviz-common.js' %}"></script> | ||
<script src="{% asset_for_js 'election-lookup.js' %}"></script> | ||
<script defer src="{% asset_for_js 'home.js' %}"></script> | ||
<script defer src="{% asset_for_js 'bythenumbers.js' %}"></script> | ||
<script defer src="{% asset_for_js 'election-lookup.js' %}"></script> | ||
<script> | ||
//remove competing/confusing querystrings on homepage | ||
$(function(){ | ||
window.onload = function () { | ||
$(function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we'd be using the the native There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Not ideal but since it was the only working solution yet, it's worth logging it to the conversation should we need to fall back on it. And only requires adding two lines of code to the existing. Do the latest changes committed since work? Were you able to confirm that before pushing.? |
||
cleanURI() | ||
function cleanURI(){ | ||
const uri = window.location.toString(); | ||
if (uri.indexOf('?') > 0) { | ||
window.history.replaceState({}, document.title, location.href.split('?')[0]); | ||
function cleanURI(){ | ||
const uri = window.location.toString(); | ||
if (uri.indexOf('?') > 0) { | ||
window.history.replaceState({}, document.title, location.href.split('?')[0]); | ||
} | ||
} | ||
} | ||
$('#main').on('change ', 'input, select', function(){ | ||
cleanURI(); | ||
}) | ||
//handle Chrome insconsistency with History API | ||
$('.js-office').val('S'); | ||
$('.js-election-year').val('2022') | ||
$('.js-chart-toggle').filter('[value=receipts]').prop('checked', true) | ||
}); | ||
$('#main').on('change ', 'input, select', function(){ | ||
cleanURI(); | ||
}) | ||
//handle Chrome insconsistency with History API | ||
$('.js-office').val('S'); | ||
$('.js-election-year').val('2022') | ||
$('.js-chart-toggle').filter('[value=receipts]').prop('checked', true) | ||
}) | ||
} | ||
</script> | ||
{% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
cleanURI()
function that we use on the homepage to keep the querystring out of the URL does not work if we deferelection-lookup.js
It needs jQuery. Specifically, the .
on
method. I tried to start writing a vanilla JS version, but it gets tricky trying to emulate$.on
. Should we replace it with vanilla JS or is there a better way around this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we change election-lookup to async?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to native on another ticket. Should I merge that one into this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did try async and got same problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever fixes it is fine with me